Tutorial by Examples

The following example shows how you can use the pushd command and the popd command in a batch program to change the current directory from the one in which the batch program was run and then change it back: @echo off rem This batch file deletes all .txt files in a specified directory pushd %1 ...
To print the directory stack, use the command pushd without any parameters: @echo off cd C:\example\ pushd one pushd ..\two pushd ..\.. pushd echo Current Directory: %cd% echo: popd pushd three pushd echo Current Directory: %cd% Output: C:\example\two ...

Page 1 of 1