批处理用文本1中的变量作为路径变量,把它的上一层目录提取出来保存到2.txt中,怎么办?
2个回答
展开全部
@echo off&setlocal enabledelayedexpansion
(for /f "delims=" %%i in (1.txt) do (set "fn=%%~dpi"
for /f "delims=" %%j in ("!fn:~,-1!") do echo %%~dpj))>>2.txt
pause
以上为演示效果,实际可参考一下代码.
@echo off&setlocal enabledelayedexpansion
for /f "delims=" %%i in (1.txt) do (set "fn=%%~dpi"
for /f "delims=" %%j in ("!fn:~,-1!") do set fns=%%~dpj&echo !fns:~,-1!>>"%%~dpj2.txt"
)
pause
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询