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-06-24 07:05
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Solved] How to remove the "/" in the date? View 4,027 Replies 27
Floor 16 Posted 2006-10-12 07:35 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
19-year member
UID 59080
Status Offline

Re:3742668

Hehe, I really created this folder. I saw the error message and thought I didn't create this folder``

The trick of "2>nul" is really brilliant oh`` No matter what error the system reports, it enforces the command to create the directory, hehe````
Floor 17 Posted 2006-10-12 07:39 ·  中国 浙江 衢州 电信
银牌会员
★★★
Credits 1,270
Posts 548
Joined 2004-05-31 00:00
22-year member
UID 25754
Gender Male
Status Offline
Adding 2>nul will prevent error messages from appearing.
Floor 18 Posted 2007-04-22 15:33 ·  中国 广东 珠海 电信
初级用户
潜水&&搜索
Credits 70
Posts 28
Joined 2007-04-22 14:36
19-year member
UID 86095
Gender Male
Status Offline
Learned, I also encountered this before, which was achieved by modifying the registry and extracting characters...
Floor 19 Posted 2007-04-22 22:51 ·  中国 安徽 芜湖 电信
中级用户
★★
Credits 247
Posts 123
Joined 2007-04-17 06:29
19-year member
UID 85468
Gender Male
Status Offline
Floor 20 Posted 2007-06-18 17:03 ·  中国 上海 联通
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
```
For /F "tokens=1" %%a in ('date/t') do md %%a
```

```
md %date%*
```

```
md *%date%
```

Test failed under XP
Even adding quotes can't create correctly


C:\>echo %date%
06/18/2007 Mon
Floor 21 Posted 2007-06-19 13:06 ·  中国 广东 广州 黄埔区 电信
初级用户
★★
Credits 132
Posts 62
Joined 2007-06-05 23:27
19-year member
UID 90371
Gender Male
Status Offline
Originally posted by HAT at 2007-6-18 05:03 PM:

For /F "tokens=1" %%a in ('date/t') do md %%a


md %date%*


md *%date%

Failed testing under XP
Even with quotes, it cannot be created correctly

For /F "tokens=1" %%a in ('date/t') do md %%a

%date:~0,4%%date:~5,2%%date:~8,2%

%date:~4,4%%date:~9,2%%date:~12,2%

These statements can only be used on XP. Can you tell me how to use the same statement to work on both XP and WIN2K? Please, all the experts come up with a solution

[ Last edited by joshualaw on 2007-6-19 at 01:12 PM ]
Floor 22 Posted 2007-06-19 13:26 ·  中国 河北 石家庄 北京神州长城通信技术发展中心中国长城互联网
初级用户
★★
Credits 152
Posts 75
Joined 2007-02-06 22:09
19-year member
UID 78805
Gender Male
Status Offline
Originally posted by joshualaw at 2007-6-19 01:06 PM:
Originally posted by HAT at 2007-6-18 05:03 PM:

For /F "tokens=1" %%a in ('date/t') do md %%a


md %date%*


md *%date%

XP ...

You can first use findstr ver to determine the operating system.
I just encountered the problem of different date formats under win2000 and xp in the morning. Annoying ah.
Floor 23 Posted 2007-06-19 13:43 ·  中国 上海 联通
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline

C:\>echo %date%
06/19/2007 Tue

The handsome guy on floor 21, please first take a look at my date display format

For /F "tokens=1" %%a in ('date/t') do md %%a
%date:~0,4%%date:~5,2%%date:~8,2%
%date:~4,4%%date:~9,2%%date:~12,2%
These three statements are not universal even under XP
Because the date display format may be different
Floor 24 Posted 2007-06-19 13:47 ·  中国 河北 石家庄 北京神州长城通信技术发展中心中国长城互联网
初级用户
★★
Credits 152
Posts 75
Joined 2007-02-06 22:09
19-year member
UID 78805
Gender Male
Status Offline
Originally posted by HAT at 2007-6-19 01:43 PM:

Handsome guy on floor 21, please first take a look at my date display format

For /F "tokens=1" %%a in ('date/t') do md %%a
%date:~0,4%%date:~5,2%%date:~8,2%
%date:~4,4%%date:~9,2%%date:~12,2%
These three statements...

Can you judge the format through some details? For example, the operating system version number?
This problem is not a big deal but very annoying. The program is not very usable when taken out.
ver >111.txt
echo %date%>>111.txt
start 111.txt


Microsoft Windows XP
Tuesday, June 19, 2007

It seems there's no way :( Could it only be changed in the Control Panel...

[ Last edited by zasxcdfv on 2007-6-19 at 02:11 PM ]
Floor 25 Posted 2007-06-19 14:02 ·  中国 上海 联通
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
//Can you judge the format through some details? Such as the operating system version number?
It seems that the system version number cannot be distinguished. ': (

C:\>ver

Microsoft Windows XP

C:\>echo %date%
06/19/2007 Tue
Floor 26 Posted 2007-06-19 14:20 ·  中国 河北 石家庄 北京神州长城通信技术发展中心中国长城互联网
初级用户
★★
Credits 152
Posts 75
Joined 2007-02-06 22:09
19-year member
UID 78805
Gender Male
Status Offline
Friends proficient in the registry can take a look at the key values in HKEY_CURRENT_USER/Control Panel/International. These should be helpful for this issue. sShortDate is the format of the date
Floor 27 Posted 2008-09-09 23:00 ·  中国 上海 闵行区 电信
初级用户
Credits 24
Posts 10
Joined 2007-11-01 10:07
18-year member
UID 101360
Gender Male
Status Offline
set d=%date%
set a=%d:~0,10%
echo %a:-=%


The operation result is

H:\>set d=2008-09-09 星期二

H:\>set a=2008-09-09

H:\>echo 20080909
20080909
Floor 28 Posted 2008-09-09 23:01 ·  中国 上海 闵行区 电信
初级用户
Credits 24
Posts 10
Joined 2007-11-01 10:07
18-year member
UID 101360
Gender Male
Status Offline
set d=%date%
set a=%d:~0,10%
echo %a:-=%


The operation result is

H:\>set d=2008-09-09 星期二

H:\>set a=2008-09-09

H:\>echo 20080909
20080909
Forum Jump: