Dec 192017
 
Save/Restore current directory from a batch file.
File SAVEDIR.ZIP from The Programmer’s Corner in
Category Batch Files
Save/Restore current directory from a batch file.
File Name File Size Zip Size Zip Type
CDCMD.DAT 3 3 stored
README.DOC 896 428 deflated
SAVEDIR.BAT 586 274 deflated

Download File SAVEDIR.ZIP Here

Contents of the README.DOC file



Have you ever run into a program that MUST be executed from a particular
directory because it loads other files from the default (current) directory ?
I have, that's why I wrote this small batch file to save the current directory
so that you can switch to another directory to execute a program and then go
back to the original directory.


For example:
-----------------------------
Current Dir: C:\Games
Program to Run: C:\LC\LCSETUP

Note: You cannot use c:\lc\Lcsetup to run this program cause it looks for
the LC configuration file in the current directory. Dumb, but true.


You could do this:
------------------
@echo off
cd\lc
lcsetup
cd\games

But, what if I start the batch files from my c:\util directory ? In this
case, I want to go back to my c:\util directory!



 December 19, 2017  Add comments

Leave a Reply