@echo off rem SWAPD 1.0.1, Daniel Beardsmore, 10th August 2004 rem http://telcontar.net/Misc/Win32/ rem Exchanges the current path with the one on the directory rem stack in the Windows commmand line. This batch script is rem placed into the public domain. Share and enjoy. rem 2004/08/10 - 1.0.1 (clears variables after use) rem 2004/07/08 - 1.0 if "%1"=="/?" goto syntax :swap rem Record the current directory set currDir=%cd% rem Collect the stored directory from the stack popd set newDir=%cd% rem Switch back to the previous drive/directory %currDir:~0,2% cd %currDir% rem Switch to the directory taken from the stack, rem pushing the current directory onto the stack pushd %newDir% rem Clear variables set newDir= set currDir= goto end :syntax echo swapd v1.0.1, Daniel Beardsmore 10th August 2004 echo Syntax: echo swapd echo. echo Purpose: echo Exchanges the current path with the one on the directory echo stack goto end :end