:次のようにfile_exist.bat文書が読み取ります
。注:のpushdとPOPDは、指定されたディレクトリ、その後、カットバックに切り替えることができますが、%〜DP0は、まだ現在のバッチファイルディレクトリを表示します。
@echo off
echo.
echo 当前盘符和路径:%~dp0
echo.
echo 当前路径下文件:
dir /b
echo.
echo 从当前盘符切换到G:\share目录下......
echo.
pushd G:\share
echo 当前路径下文件:
dir /b
echo 当前盘符路径:%~dp0
echo.
echo 切换回原盘符和路径......
popd
echo.
echo 当前路径下文件:
dir /b
echo 当前盘符路径:%~dp0