Oh gosh, gotta expose myself as a noob here ;)

In Windows, I need to execute a batch file in a subdirectory of the working directory. However, just running subdir/foo.bat cmd1 cmd2 does not work, and I get an error saying

The command "subdir" cannot be found.

What am I doing wrong?

link|improve this question
feedback

1 Answer

up vote 2 down vote accepted

There are different ways to do this.

If dirs are:

c:\workdir\batfile-dir\

and you are currently in \workdir\

You can do this: .\batfile-dir\foo.bat

The thing to remember is that foo.bat will be running with a "current directory" of \workdir\

HTH

link|improve this answer
Oh my goodness. I used slashes instead of backslashes. Another reason to hate on Windows, possibly...? Thanks for your help, anyways. It's appreciated. – Franz Nov 5 '09 at 1:52
There's no need for the leading ".\" – John Gardeniers Nov 12 '09 at 1:29
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.