中国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-08 12:04
47,811 topics / 349,895 posts / today 0 new / 48,253 members
DOS批处理 & 脚本技术(批处理室) » [Help] How to change the creation time of a file
Printable Version  2,155 / 11
Floor1 LONGWJR Posted 2008-05-05 22:39
新手上路 Posts 5 Credits 12
I want to create a file, but I want the creation time displayed not to be the current day. I don't know how to achieve it with a batch file. Please advise.
Floor2 HAT Posted 2008-05-05 23:09
版主 Posts 5,017 Credits 9,023
```
@echo off
echo 04-05-2008|date
type nul>test.txt
echo 05-05-2008|date
```
Floor3 bat-zw Posted 2008-05-05 23:59
金牌会员 Posts 1,276 Credits 3,105
```
@echo off
echo 2008-04-05|date
type nul>test.txt
echo 2008-05-05|date
[ Last edited by zw19750516 on 2008-5-6 at 12:00 AM ]
```
Floor4 LONGWJR Posted 2008-05-06 21:58
新手上路 Posts 5 Credits 12
Thank you two, but it seems that this has changed the system time. Can it be done without changing the system time?
Floor5 LONGWJR Posted 2008-05-06 22:09
新手上路 Posts 5 Credits 12
According to the ideas of the two, I also thought about changing the system time, but it's too troublesome because the current date is always being changed
@echo off
date 2008-04-05
type nul>test.txt
date 2008-05-05
Floor6 zh159 Posted 2008-05-06 22:15
金牌会员 Posts 1,467 Credits 3,687
```@echo off
set date_=%date:~0,10%
date 2008-04-05
type nul>test.txt
date %date_%
```
Floor7 HAT Posted 2008-05-06 23:22
版主 Posts 5,017 Credits 9,023
Originally posted by zw19750516 at 2008-5-5 11:59 PM:


[ Last edited by zw19750516 on 2008-5-6 at 12:00 AM ]

Different operating systems have different date formats. Yours is year-month-day, and mine is month-day-year. You can first determine the date format through the registry.
Floor8 joyn Posted 2008-05-07 03:51
中级用户 Posts 105 Credits 280 From 广西
A bit classic~~It's like cursing in a roundabout way^_^(for example)
Floor9 cad55 Posted 2008-05-07 08:22
高级用户 Posts 329 Credits 620
This is too difficult. Find a tool to modify file attributes. Can batch change...
Floor10 uemuem Posted 2008-05-07 16:47
初级用户 Posts 68 Credits 153 From 上海
Originally posted by HAT at 2008-5-5 23:09:

It doesn't work on 5-6, haha...
Floor11 HAT Posted 2008-05-07 23:09
版主 Posts 5,017 Credits 9,023
Originally posted by uemuem at 2008-5-7 04:47 PM:

5-6 can't be used, haha...

When the month or day is a single digit, it needs to be padded with 0 to make it two digits. I don't know what you mean by 5-6
Floor12 pusofalse Posted 2008-05-08 00:07
银牌会员 Posts 646 Credits 1,604
The post on floor 11 reminds me of the Y2K bug - -|||
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023