我有a.bat如下,显示各种参数的扩展值:
@echo off
cls
echo 1=%1
echo ~1=%~1
echo ~f1=%~f1
echo ~p1=%~p1
echo ~n1=%~n1
echo ~s1=%~s1
echo ~dp1=%~dp1
执行a "c:\afff sf\ttt.txt",显示结果如下:
1="c:\afff sf\ttt.txt"
~1=c:\afff sf\ttt.txt
~f1=c:\afff sf\ttt.txt
~p1=\afff sf\
~n1=ttt
~s1=c:\afff sf\ttt.txt
~dp1=c:\afff sf\
查看call /?,~s1是返回短格式名称,但这里返回的并不是短格式而是完整的c:\afff sf\ttt.txt,不知是何故,请教. win2000/winxp/win2003都是如此,win98好像无法解释扩展参数,带~的都返回空
注:此扩展有个限制,即要被扩展的目录存在,才能转换成短格式,否则原样返回
Last edited by dejoy on 2008-9-25 at 11:37 PM ]