tips.paddyonline.net

If you need tips & tricks, here they are...

Start file in same directory as batch file

If you want to be able to start a bat, cmd, exe, com or other executable from the same directory as where you have a batch file. Like this, in the directory c:\private\scripts    you have a batch file called start.bat
In that file you want to start the file calc.exe

Check this out..

%0 has the full name of the batch file, including the path. To change to the directory where the batch file is, you'd want to do:

cd %0\..\

You can run a program in the same directory as the batch file by doing:

%0\..\myreallylongexecutablefilename.exe


So starting calc.exe in the directory c:\private\scripts would mean you put this inside a bat file.
%0\..\calc.exe

Add comment

Security code
Refresh

Please consider supporting our efforts.


We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.