中国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-11-10 11:12
47,815 topics / 349,930 posts / today 0 new / 48,291 members
DOS批处理 & 脚本技术(批处理室) » [Sharing] Advanced Application Examples of the "FOR" Command
Printable Version  14,262 / 59
Floor16 brglng Posted 2005-08-08 11:31
银牌会员 Posts 466 Credits 1,200 From 上海
It would be great if the pure DOS command interpreter could be as powerful as the CMD in 2K/XP someday
Floor17 jon047 Posted 2005-11-02 23:13
新手上路 Posts 2 Credits 4
Been looking for this for a long time~` bump bump bump!!
Floor18 duckgaga Posted 2007-05-17 00:52
新手上路 Posts 3 Credits 4
I'm completely convinced... DOS commands are really powerful...
Floor19 luobotou Posted 2007-05-17 15:25
新手上路 Posts 7 Credits 16 From 河南省南阳市
When I use the AT command to run a batch file on schedule, if the batch file contains FOR, it just never works.


for /f %%a in (to.txt) do del %%a /q

The to.txt file is in the current folder.

Every time it runs, it says it can't find the to.txt file. If I directly click the batch file to run it, there's no problem.

I don't know why... when called by at it just won't run successfully.....

Asking the experts, where is the problem?
Floor20 ybinn Posted 2007-05-23 22:36
新手上路 Posts 5 Credits 10 From 山东淄博
c:\md yubin Such a simple batch file content made me unable to hold back and want to find someone to pour out my heartfelt joy. From c:\md yubin to IF for, how many detours I took, how much effort I went through, but in the end I was still tripped up by IF for. Asking some big brother or big sister who knows IF for to solve these two puzzles for me.
I don't want to ask people for help either, but I can't help it, who told me I'm so fond of dos. QQ 648620644
I've studied it for a long time and really just can't figure it out~~
Floor21 shilw Posted 2007-05-23 23:17
新手上路 Posts 4 Credits 10
Let me try replying to a post
Floor22 panda Posted 2007-05-24 22:27
新手上路 Posts 8 Credits 15
Thanks for the OP's support
Floor23 xjjerry Posted 2007-05-24 23:19
新手上路 Posts 1 Credits 2
Thanks
Floor24 rechard Posted 2007-05-25 10:44
新手上路 Posts 9 Credits 18
I just tried:
for %a in (*.txt) do type %a

But if the filename contains spaces, for example:
001.txt
复件 001.txt

it can only display 001.txt, but can't display the contents of the file "复件 001.txt". How should it be modified?
Floor25 yesnoyes Posted 2007-06-11 18:16
新手上路 Posts 2 Credits 3
Thanks a lot for sharing! I'm learning this now!
Floor26 wolfxiong Posted 2007-06-19 23:00
新手上路 Posts 3 Credits 6
:P Sooner or later I'll learn this command
Floor27 duanml Posted 2007-06-19 23:11
中级用户 Posts 112 Credits 231
"for" is really too useful now. Unlike in the past, when I could only use goto for everything. Once a bat file went past 100 lines, I had no idea where goto was jumping anymore.
Floor28 kelvin007 Posted 2007-06-20 00:27
新手上路 Posts 1 Credits 2
Learned something. Thanks.
Floor29 luowanli1984 Posted 2007-06-20 18:51
初级用户 Posts 27 Credits 65 From china
Bump, I don't use for very brilliantly...
Floor30 superhacker Posted 2007-06-22 15:16
初级用户 Posts 32 Credits 66
I've finally seen the true charm of the FOR command.
If only it could all be a bit more detailed. Then I'd have no problem learning DOS
Prev  1 2 3 4  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023