打印目录堆栈

要打印目录堆栈,请使用命令 pushd,不带任何参数:

@echo off

cd C:\example\
pushd one
pushd ..\two
pushd ..\..

pushd
echo Current Directory: %cd%

echo:
popd
pushd three

pushd
echo Current Directory: %cd%

输出:

C:\example\two                            
C:\example\one
C:\example                                
Current Directory: C:\                        

C:\example\two                            
C:\example\one
C:\example                                
Current Directory: C:\example\two\three