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-06 10:31
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Help] Execute the following commands based on the modification time or creation time of the file View 2,287 Replies 15
Original Poster Posted 2007-11-05 14:36 ·  中国 重庆 沙坪坝区 电信
中级用户
★★
金牌会员
Credits 315
Posts 152
Joined 2007-01-25 23:55
19-year member
UID 77669
Gender Male
Status Offline
I want the computer to judge the modification time or creation time of a specified file. If it is different from the latest version of the file, automatically record the computer name to the server log. The key is how to compare whether the versions of two files with the same name are the same (the sizes are also the same).

[ Last edited by fengzi on 2007-11-5 at 02:45 PM ]
Floor 2 Posted 2007-11-05 14:51 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline
Floor 3 Posted 2007-11-05 14:58 ·  中国 重庆 沙坪坝区 电信
中级用户
★★
金牌会员
Credits 315
Posts 152
Joined 2007-01-25 23:55
19-year member
UID 77669
Gender Male
Status Offline
Thanks lxmxn
If I want to view d:\tools, how should I write it~?
Floor 4 Posted 2007-11-05 15:09 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline
Command line execution:
for %a in (D:\dools) do @for /F %b in ("%~ta") do @if "%b" neq "2007-11-04" echo The modification date of the file is not 2007-11-04
Floor 5 Posted 2007-11-05 15:12 ·  中国 重庆 沙坪坝区 电信
中级用户
★★
金牌会员
Credits 315
Posts 152
Joined 2007-01-25 23:55
19-year member
UID 77669
Gender Male
Status Offline
The execution has no display. I added pause at the back and still can't see the display result. It's estimated that there's an error. Also, I don't know what the role of "neq" is in the command.
Floor 6 Posted 2007-11-05 15:15 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline
Try this:
for %a in (D:\dools) do @for /F %b in ("%~ta") do @if "%b" neq "2007-11-04" (echo The modification date of the file is not 2007-11-04) else (echo The modification time of the file is 2007-19-04)


What does neq mean? Have you read the sticky FAQ?
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
fengzi +4 2007-11-05 15:37
Floor 7 Posted 2007-11-05 15:19 ·  中国 重庆 沙坪坝区 电信
中级用户
★★
金牌会员
Credits 315
Posts 152
Joined 2007-01-25 23:55
19-year member
UID 77669
Gender Male
Status Offline
Still can't display the result.
Dizzy...
Floor 8 Posted 2007-11-05 15:22 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline
Check carefully if D:\dools exists.
Floor 9 Posted 2007-11-05 15:22 ·  中国 香港 腾讯云
银牌会员
★★★
Credits 1,436
Posts 739
Joined 2007-10-11 17:44
18-year member
UID 99469
Gender Male
Status Offline
Where did the landlord execute the above statement? In the P processing file? Or in cmd?
Floor 10 Posted 2007-11-05 15:26 ·  中国 重庆 沙坪坝区 电信
中级用户
★★
金牌会员
Credits 315
Posts 152
Joined 2007-01-25 23:55
19-year member
UID 77669
Gender Male
Status Offline
I copied it into the command line to execute. The file d:\tools does exist. I don't know if dir /t can be used to achieve it.
Floor 11 Posted 2007-11-05 15:30 ·  中国 香港 腾讯云
银牌会员
★★★
Credits 1,436
Posts 739
Joined 2007-10-11 17:44
18-year member
UID 99469
Gender Male
Status Offline
My test is okay, no problem. It can be displayed.
Floor 12 Posted 2007-11-05 15:31 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline
Alas well. Told you to look carefully......
Really very depressed.
Floor 13 Posted 2007-11-05 15:32 ·  中国 重庆 沙坪坝区 电信
中级用户
★★
金牌会员
Credits 315
Posts 152
Joined 2007-01-25 23:55
19-year member
UID 77669
Gender Male
Status Offline
The specific situation is that in the Internet café where I am located, there is an issue with the map files of "World of Warcraft" in the e:\Online Games\World of Warcraft\ directory on dozens of client machines, and they cannot run normally. At the same time, the update from the server is very slow and it is easy to cause congestion in the internal network. So I asked the following network administrators to manually update this game. But when several network administrators were updating the game, for some reason, a small part was not updated. What I need to do now is to find these client machines that have not been updated by comparing the times of the game files.
Floor 14 Posted 2007-11-05 15:34 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline
I wrote D:\dools
You wrote D:\tools

Sometimes a very simple problem can really drive you crazy...
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
fengzi -1 2007-11-05 15:37
Floor 15 Posted 2007-11-05 15:36 ·  中国 重庆 沙坪坝区 电信
中级用户
★★
金牌会员
Credits 315
Posts 152
Joined 2007-01-25 23:55
19-year member
UID 77669
Gender Male
Status Offline
...
You are on purpose...
Forum Jump: