How can a batch file by itself see where it is located?
+1
A:
Just call "cd"
set WORKING_DIRECTORY=%cd%
Used to be %~dp0, but that's not working for me in Vista.
Chris Doggett
2009-05-25 03:23:58
That's not the location of the cmd file, it's the working directory when you run it, which is not the same thing: "cd \" followed by "\directory\x.cmd" will have %cd% set to "\", not "\directory".
paxdiablo
2009-05-25 03:26:33
no, this is a piece of shit (sorry) above works great.
YourComputerHelpZ
2009-05-25 15:34:50
+9
A:
%0 is the name of the file. %~dp0 will be the absolute location of the file, with d being the drive, p being the path, and 0 being the filename.
rpkelly
2009-05-25 03:24:12