RT
s.txt 内容如下:
i"love"u
用for /f 命令来读取love:
@echo off
for /f "tokens=2 delims="" %%i in (s.txt) do echo %%i
这里的"貌似有问题 执行出错
请各位大大教教小菜 若要将delims指定为" 时,如何实现?
PS.在一个帖子里看到一行命令:
if /i "%~d0"=="c:" (exit) else (cd c:)
这里的%~d0是什么意思?指的是什么?
感谢各位大大不吝赐教
Last edited by Will on 2008-8-4 at 01:09 AM ]
@echo off
set/p var=<s.txt
for /f "tokens=2" %%a in ("%var:"= %") do echo %%a
pause>nul
%~1 - expands %1 removing any surrounding quotes (")
%~f1 - expands %1 to a fully qualified path name
%~d1 - expands %1 to a drive letter only
%~p1 - expands %1 to a path only
%~n1 - expands %1 to a file name only
%~x1 - expands %1 to a file extension only
%~s1 - expanded path contains short names only
%~a1 - expands %1 to file attributes
%~t1 - expands %1 to date/time of file
%~z1 - expands %1 to size of file
%~$PATH:1 - searches the directories listed in the PATH
environment variable and expands %1 to the fully
qualified name of the first one found. If the
environment variable name is not defined or the
file is not found by the search, then this
modifier expands to the empty string
Last edited by pusofalse on 2008-8-4 at 01:51 AM ]