Digging through some old Win9x batch files I have, I adapted a line that MIGHT work for you.
Code: Select all
echo exit|%COMSPEC% /K prompt CD $P$_|find " " > recall.bat
To restore your location, you'd use:
What it's actually doing is starting a new instance of command.com, changing the prompt to ''CD CURRENT_PATH NEWLINE", echoing an exit command to that new command.com, and parsing the new command.com's output with find to write out a file that contains the command:
CD CURRENT_PATH
Obviously you can change the output to go to a file in a folder of your choosing.
This was adapted from an old batch to generate a %CD% environment variable, and honestly, I'm sure it could be improved, but I didn't want to tweak it too much as I'm sitting at an XP computer and am not positive I wouldn't mess things up.
Also, this was for a batch file for an older version of Windows that still used command.com, so while I expect it to work under just DOS, I'm not certain.
Good luck!
Queue