tags:

views:

38

answers:

2

I'm writing a .bat script for Windows. Is there any command that I can use within the script to retrieve the directory that the script is in?

A: 

echo %CD%

should work

JoseK
I didn't ask for the current directory, I asked for the directory that the script is in.
cool-RR
aw, was assuming you ran the script from the same directory
JoseK
That's not always a valid assumption :-)
Joey
+2  A: 

from : http://ss64.com/nt/cd.html

In a batch file to display the location of the batch script file (%0)

ECHO "%~dp0"

Danail