列印目錄堆疊

要列印目錄堆疊,請使用命令 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