中国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-04 03:16
48,038 topics / 350,123 posts / today 0 new / 48,251 members
DOS批处理 & 脚本技术(批处理室) » [Help] A problem at our company that lots of people still can't solve!!!
Printable Version  878 / 8
Floor1 acme Posted 2007-04-10 08:39
中级用户 Posts 98 Credits 238 From 陕西
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
Floor2 vkill Posted 2007-04-10 08:40
金牌会员 Posts 1,744 Credits 4,103 From 甘肃.临泽
OP, search first before posting, ok?
Floor3 acme Posted 2007-04-10 08:53
中级用户 Posts 98 Credits 238 From 陕西
Please help point me in the right direction, thanks!
Floor4 vk Posted 2007-04-10 09:07
中级用户 Posts 86 Credits 218
md (specified path)\"%date%"
Floor5 acme Posted 2007-04-10 09:37
中级用户 Posts 98 Credits 238 From 陕西
Thanks very much, brother. Can you leave your name?
Floor6 airosp Posted 2007-04-11 06:42
初级用户 Posts 41 Credits 99
Floor7 acme Posted 2007-04-11 10:51
中级用户 Posts 98 Credits 238 From 陕西
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?
Floor8 bjsh Posted 2007-04-11 11:24
银牌会员 Posts 621 Credits 2,000
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
Floor9 acme Posted 2007-04-11 11:31
中级用户 Posts 98 Credits 238 From 陕西
Thanks, it's already ok.
If I want to ask a question, how do I search first on this site?
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023