I have a
bat file on windows that execute a procdump operation. The issue with the batch file is that I need to cd to the batch file directory first before executing the job, or else the script won't work.
How to change to the current batch file directory?
I tried the following code in my
cd "%~dp" procdump -h devenv.exe mydump.txt
But it failed, the error message is:
The following usage of the path operator in batch-parameter substitution is invalid: %~dp"
For valid formats type CALL /? or FOR /?
Edit: The answer provided is working, but there is only one catch: if my current directory is different than the batch file directory, then I would get a "The system cannot find the path specified". Anyone has any ideas?