本shell/bat的文件名字赋值给变量 test1.sh/test.bat → 变量=test 【变量】=`dirname 【文件】` for %%i in ("【文件】") do (set 【变量】=%%~dpi) 取得所在文件路径赋值给变量 例: shell: path1=`dirname /home/dir1/dir2/test.txt` ↓ path1=/home/dir1/dir2 bat : for %%i in ("D:\...
path2=D:\dir1\dir2 【变量】=`basename 【文件】` for %%i in ("【文件】") do (set 【变量】=%%~nxi) 取得所在文件路径赋值给变量 例:shell: filename1=`dirname /home/dir1/dir2/test.txt` ↓ filename1=test.txt bat : for %%i in ("D:\dir1\dir2\test.txt") do ( set filename2...