Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 3 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

share|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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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