中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-12 13:37
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS批处理 & 脚本技术(批处理室) » Use a batch file to search for and open files under long directory names
Printable Version  814 / 1
Floor1 uforange Posted 2010-03-31 20:14
中级用户 Posts 92 Credits 265 From 广西
Hello everyone!
The environment is under cmd on an XP system. I use for /f %%i in ('dir/s/b/a-d c:\a.bat') do (start "" "%%i"), and under normal circumstances it works....


But when a.bat is on the desktop it won't open... I've searched the forum for a lot of related stuff, but still couldn't solve it myself. If anyone knows, please help. Thanks in advance!!

[ Last edited by uforange on 2010-3-31 at 20:17 ]
Floor2 Hanyeguxing Posted 2010-03-31 21:03
银牌会员 Posts 897 Credits 1,039 From 在地狱中仰望天堂

Don't make this kind of elementary mistake; it should be written like this

A few default values of for /f:
eol=c defaults to lines beginning with ;, and this is still the case even if eol= is not used
delims=xxx defaults to spaces and tabs, and this is still the case even if delims= is not used
tokens=x,y,m-n defaults to 1, and this is still the case even if tokens= is not used


for {%variable|%%variable} in (set) do command
No matter which form for uses, in (set) separation is done by spaces, tabs, English commas, and English semicolons (in for /f, only by spaces and tabs).


Because the first character of a local pathname cannot be ;, there is no need here to forcibly specify eol= as empty

[ Last edited by Hanyeguxing on 2010-3-31 at 21:22 ]
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023