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-04 02:22
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Help] A problem at our company that lots of people still can't solve!!! View 876 Replies 8
Original Poster Posted 2007-04-10 08:39 ·  中国 江苏 苏州 电信
中级用户
★★
Credits 238
Posts 98
Joined 2007-04-10 07:50
19-year member
UID 84593
Gender Male
From 陕西
Status Offline
How can I use DOS to make a batch file that creates, under a specified path, a folder named with the current date?
For example: if it is run today, it will create under the specified path: 2007-04-09
if it is run tomorrow, it will create under the specified path: 2007-04-10
If any expert knows the answer, I would be very grateful if you could reply by email and let me know.
e-mail: jsj011gaofeng@163.com
Floor 2 Posted 2007-04-10 08:40 ·  中国 甘肃 平凉 电信
金牌会员
★★★★
Credits 4,103
Posts 1,744
Joined 2006-01-20 13:00
20-year member
UID 49241
Gender Male
From 甘肃.临泽
Status Offline
OP, search first before posting, ok?
Floor 3 Posted 2007-04-10 08:53 ·  中国 江苏 苏州 电信
中级用户
★★
Credits 238
Posts 98
Joined 2007-04-10 07:50
19-year member
UID 84593
Gender Male
From 陕西
Status Offline
Please help point me in the right direction, thanks!
Floor 4 Posted 2007-04-10 09:07 ·  中国 上海 东方有线
中级用户
★★
Credits 218
Posts 86
Joined 2006-08-10 10:45
19-year member
UID 60205
Gender Male
Status Offline
md (specified path)\"%date%"
Floor 5 Posted 2007-04-10 09:37 ·  中国 江苏 苏州 电信
中级用户
★★
Credits 238
Posts 98
Joined 2007-04-10 07:50
19-year member
UID 84593
Gender Male
From 陕西
Status Offline
Thanks very much, brother. Can you leave your name?
Floor 6 Posted 2007-04-11 06:42 ·  中国 河北 石家庄 电信
初级用户
Credits 99
Posts 41
Joined 2007-02-19 03:42
19-year member
UID 79773
Gender Male
Status Offline
Floor 7 Posted 2007-04-11 10:51 ·  中国 江苏 苏州 电信
中级用户
★★
Credits 238
Posts 98
Joined 2007-04-10 07:50
19-year member
UID 84593
Gender Male
From 陕西
Status Offline
But, everyone, when I use md specified path\ “%date%"
the folder format created is:
Tuesday 2007\04\10
But what I need is:
the format
2007-04-10
?
Is there a better way?
Floor 8 Posted 2007-04-11 11:24 ·  中国 浙江 杭州 华数宽带
银牌会员
★★★
Credits 2,000
Posts 621
Joined 2007-01-01 00:00
19-year member
UID 75212
Gender Male
Status Offline
md specified path\ “%date:~4%"

If that's not right, you can try changing the 4 to 3 or 5 and so on;

2007-04-10 Tuesday, for example, my system's %date% format is like this, and I want to take 2007-04-10

%date:~0,10%

From what you posted, it seems your system's %date% format is Tuesday 2007\04\10

This should be %date:~4%

So md specified path\ “%date:~4%"


Someone asked this question long ago already;

Please search before asking questions
Floor 9 Posted 2007-04-11 11:31 ·  中国 江苏 苏州 电信
中级用户
★★
Credits 238
Posts 98
Joined 2007-04-10 07:50
19-year member
UID 84593
Gender Male
From 陕西
Status Offline
Thanks, it's already ok.
If I want to ask a question, how do I search first on this site?
Forum Jump: