China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-06 02:59
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Solved] Problem with the for /f loop, I can never get the correct result View 794 Replies 3
Original Poster Posted 2007-08-22 21:55 ·  中国 山西 临汾 联通
中级用户
★★
Credits 216
Posts 81
Joined 2007-08-06 12:23
18-year member
UID 94721
Gender Male
Status Offline
for /f "tokens=3 delims=- " %a in ('date /t') do @echo %a
pause

date /t shows 2007-08-22 Wednesday

But as soon as I run the code above, an error appears:

No matter what, I can't get the final result. Where is the mistake?

[ Last edited by icyheart on 2007-8-22 at 10:03 PM ]
Attachments
1.jpg
Floor 2 Posted 2007-08-22 21:59 ·  中国 陕西 西安 电信
铂金会员
★★★★
Credits 5,212
Posts 2,478
Joined 2007-02-08 23:39
19-year member
UID 79003
Gender Male
Status Offline
In a bat file it's %%a
Floor 3 Posted 2007-08-22 22:02 ·  中国 山西 临汾 联通
中级用户
★★
Credits 216
Posts 81
Joined 2007-08-06 12:23
18-year member
UID 94721
Gender Male
Status Offline
Thanks, looks like I really got myself mixed up, I was getting dizzy reading it
Floor 4 Posted 2007-10-15 02:37 ·  中国 浙江 台州 电信
新手上路
Credits 2
Posts 2
Joined 2007-10-15 00:20
18-year member
UID 99769
Gender Male
Status Offline
NXX I used to be dumb enough that I didn't dare look at it hahaha~~
Forum Jump: