zfkzp 当前离线
上等兵
D:\winxp\i love bat\bathome!.bat复制代码
D:\winxp\i love bat\复制代码
评分人数
tmplinshi 当前离线
版主
@echo off for %%i in ("D:\winxp\i love bat\bathome!.bat") do echo %%~dpi pause复制代码
@echo off set str=D:\winxp\i love bat\bathome!.bat set str_temp=%str% for %%i in ("%str:\=" "%") do set end=%%~i setlocal enabledelayedexpansion echo !str_temp:%end%=! pause复制代码
TOP
2# tmplinshi Thank you very much! 那要是截取最后出现的\之后的"bathome!.bat"呢? zfkzp 发表于 2011-6-23 16:52
for %%i in ("D:\winxp\i love bat\bathome!.bat") do echo %%~nxi复制代码
用set也是同样的道理吗?
for %%i in ("%str:\=" "%") do set end=%%~i复制代码
@echo off set str=D:\winxp\i love bat\bathome!.bat for %%i in ("%str:\=" "%") do set end=%%~i echo %end% pause复制代码
applba 当前离线
中校