What does pushd %~dp0
in .cmd
file means? I understand that %~dp0
means it indicates a drive letter. What does pushd
indicate?.
Asked
Active
Viewed 3.4k times
9
-
Also see [docs for pushd](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/pushd) – djvg May 26 '22 at 12:27
1 Answers
16
Save the current directory on a stack and change to %~dp0
which is the drive-and-path of the "0'th" command-line parameter (which is the command itself) so the destination path to be set is the drive/path of the batch file to be executed.
To return to the original path, you need a popd

Magoo
- 77,302
- 8
- 62
- 84