|
|
Question : Get Batch CMD Path from within the batch file
|
|
Hello,
Here is what I'm trying to do.
I have a CMD file that is at any place on a PC but I don't know where. People can move the folder, so the CMD can move too.
Yet, I will always be able to run it since it is in the PATH.
I would like the first line of the CMD to change the CurrentPath to the Path where the CMD is.
Is there a DOS function, like the App.Path VB property, that returns the path of the CMD on the drive?
Thanks a lot
|
Answer : Get Batch CMD Path from within the batch file
|
|
The command "%~dp0" should return the drive and path of the currently running .CMD file. So you could probably do somethinng like: set path=%~dp0;%path% This path statement would only last for the duration of your .CMD file, but it sounds like that is what you want.
|
|
|
|
|