Board logo

标题: 语句错哪啦 [打印本页]

作者: luuk     时间: 2010-4-21 12:48    标题: 语句错哪啦

@echo off
for /f "delims=\,tokens=4" %%i in('G:\Documents and Settings\Administrator.CHINA-8E663A9D9\桌面\b.txt') do echo %%i >>c.txt

pause
=====================================
双击不运行啊
作者: sujinglong     时间: 2010-4-21 13:18    标题: 语法错误

%%i in(....  应为 %%i in ( ...   漏了空格 ;


FOR /F ["options"] %variable IN (file-set) DO command [command-parameters]
FOR /F ["options"] %variable IN ("string") DO command [command-parameters]
FOR /F ["options"] %variable IN ('command') DO command [command-parameters]

‘’ 里面应是命令而不是路径名, 故这里应该是”“。

@echo off
for /f "delims=\,tokens=4" %%i in (”G:\Documents and Settings\Administrator.CHINA-8E663A9D9\桌面\b.txt“) do echo %%i >>c.txt

pause
作者: Hanyeguxing     时间: 2010-4-21 14:10
1,()内的‘’要改成“”
2,"delims=\,tokens=4"中间用空格分隔
3,in(中间用空格分隔
4,echo %%i >>c.txt应写成>>c.txt echo %%i
作者: luuk     时间: 2010-4-21 18:21
我想用for /f 命令分析G:\Documents and Settings\Administrator.CHINA-8E663A9D9\桌面\  下的一个文件b.txt,找楼上两位大侠的方法是了,说是找不到G:\Documents and 文件
作者: luuk     时间: 2010-4-21 18:25
我有改啦一下G:\Docume~1\Administrator.CHINA-8E663A9D9\桌面\b.txt   然后运行就OK啦。。。。。但我还想知道,如果我不用~1代替,怎么在in (。。。)里输入带有空格的路径,需要加什么符号?