![]() |
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-10 16:59 |
47,811 topics / 349,897 posts / today 0 new / 48,256 members |
| DOS批处理 & 脚本技术(批处理室) » How to read the modification time of a file |
| Printable Version 3,875 / 8 |
| Floor1 uemuem | Posted 2006-10-13 21:35 |
| 初级用户 Posts 68 Credits 153 From 上海 | |
|
I searched the forum and didn't find a post discussing this issue, so I'm posting to ask everyone for help:
How to read the modification time of a file, for example: D:\test.xls How to obtain the modification time of this file, for example: June 13, 2006, 13:36:28 [ Last edited by uemuem on 2006-10-14 at 01:33 ] |
|
| Floor2 9527 | Posted 2006-10-13 21:45 |
| 银牌会员 Posts 438 Credits 1,185 From 北京 | |
|
@echo off
echo %~t1 Saved as test.cmd Running test.cmd d:\test.xls should allow you to see it |
|
| Floor3 uemuem | Posted 2006-10-13 21:54 |
| 初级用户 Posts 68 Credits 153 From 上海 | |
|
Thanks, this works, but it's a bit cumbersome. Can you combine it into one BAT file and save the result to 1.txt? I just tried it and it didn't work properly.
|
|
| Floor4 9527 | Posted 2006-10-13 22:00 |
| 银牌会员 Posts 438 Credits 1,185 From 北京 | |
|
@echo off
call :dan D:\test.xls start 1.txt goto :eof :dan echo %~t1 >1.txt goto :eof [ Last edited by pip on 2006-10-14 at 02:45 ] |
|
| Floor5 uemuem | Posted 2006-10-13 22:02 |
| 初级用户 Posts 68 Credits 153 From 上海 | |
|
Really thank you, thank you PIP, I want to use him to judge whether the file has been modified, and then make a backup!
|
|
| Floor6 不得不爱 | Posted 2006-10-13 22:12 |
| 超级版主 Posts 2,044 Credits 5,310 From 四川南充 | |
|
To determine whether a file has been modified, one way is to judge by the modification time, and the other is to look at the archive attribute (you need to remove the archive attribute first before).
|
|
| Floor7 uemuem | Posted 2006-10-13 22:41 |
| 初级用户 Posts 68 Credits 153 From 上海 | |
|
The moderator's words are a bit advanced, and I don't quite understand.
Can you give an example? Or give an automatic backup code for beginners to learn. I've just started and have too many things to learn. For example: I want to judge whether D:\test.xls has been changed. If it has been changed, back it up to E:\test modification time.xls; if it hasn't been changed, do nothing... [ Last edited by uemuem on 2006-10-13 at 22:47 ] |
|
| Floor8 vkill | Posted 2006-10-13 23:39 |
| 金牌会员 Posts 1,744 Credits 4,103 From 甘肃.临泽 | |
|
Figuring this out will solve your problem:
http://www.cn-dos.net/forum/viewthread.php?tid=22195&fpage=1 |
|
| Floor9 namejm | Posted 2006-10-14 01:04 |
| 荣誉版主 Posts 1,737 Credits 5,226 From 成都 | |
|
The most commonly used commands often contain the most powerful functions. Please see the relevant help information for dir:
|
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |