2

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?

1 Answer 1

5

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

2
  • 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, 2009 at 1:52
  • There's no need for the leading ".\" Nov 12, 2009 at 1:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .