Skip to content

Instantly share code, notes, and snippets.

@Hrxn
Last active November 5, 2016 09:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hrxn/605289db2e68576b7359c6bc997c776d to your computer and use it in GitHub Desktop.
Save Hrxn/605289db2e68576b7359c6bc997c776d to your computer and use it in GitHub Desktop.
CMD: Examples for PUSHD and POPD
---------------------------------------------------------------------------------
:: 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
---------------------------------------------------------------------------------
@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