What code would I use to specify the directory to be the current location of the batch file that I'm running? For example, I want my script to access a file in the same folder as itself, but I want to be able to move the folder around without changing the script every time.How to change the cmd directory to location of current batch file?
%~dp0
As in:
echo foo %26gt; %~dp0foo.txt
That should write foo.txt into the same directory as your .bat file, no matter where you run it from.
See link for details:How to change the cmd directory to location of current batch file?
perhaps
cd ./
would work
Subscribe to:
Post Comments
(Atom)
No comments:
Post a Comment