Last active
November 5, 2016 09:17
-
-
Save Hrxn/605289db2e68576b7359c6bc997c776d to your computer and use it in GitHub Desktop.
CMD: Examples for PUSHD and POPD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--------------------------------------------------------------------------------- | |
:: 1 | |
@echo off | |
PUSHD . | |
CD /D %AppData%\example | |
MD sub | |
CD /D E:\Test\files\xdir | |
COPY /Y file.ext %AppData%\example\sub\file.ext | |
POPD | |
--------------------------------------------------------------------------------- | |
:: 2 | |
@echo off | |
PUSHD . | |
CD /D %AppData%\example\sub | |
MOVE /Y file.ext E:\Test\files\xdir\file.ext | |
CD .. | |
RD sub | |
POPD | |
--------------------------------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
pushd %~dp0 | |
... | |
cd %~dp0files\xdir | |
... | |
popd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment