Batch basis (xii) change your disk path

file_exist.bat document reads as follows:
Note: pushd and popd can switch to the specified directory and then cut back, but% ~ dp0 still displays the current batch file directory.

@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

Here Insert Picture Description

Published 228 original articles · won praise 44 · Views 100,000 +

Guess you like

Origin blog.csdn.net/qq_40945965/article/details/86756053