用于确定修改日期的批处理文件
嘿伙计们,我正在寻找一个批处理文件来告诉我今天某些文件夹是否已被修改(我每天早上都会运行它)。我很高兴指定要查询的每个文件夹,我只是还没有找到满足我要求的任何内容。如果有人立即知道 .bat 的代码是什么,那就太棒了:) 提前致谢。
Hey guys, I'm looking for a batch file to tell me if certain folders have been modified today (I'll run it every morning). I'm happy to specify each of the folders to be to be queried, I just haven't been able to find anything that meets my requirements yet. If anyone knows off the top of their head what the code for the .bat would be, that would be awesome :) Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一个可以解决这个问题的批处理文件:
它通过将文件时间戳的日期部分与当前日期进行比较来工作。
正如所写,它检查当前目录中的目录,但您可以将 *.* 替换为您想要测试的任何文件规范(或将其作为参数传递)。
我不知道这是否适用于具有其他默认英语/美国区域设置的系统,但如果还没有的话,可能可以对其进行调整以使其工作。我也不知道如果系统在不同时区的用户之间共享会发生什么。
Here's a batch file that should do the trick:
This works by comparing the date-part of the file timestamp against the current date.
As written, it checks directories in the current directory, but you could replace *.* with whatever filespec you want to test (or pass it in as an argument).
I don't know if this will work on systems with anything other default English/US regional settings, but it could probably be tweaked to make it work, if it doesn't already. I also don't know what would happen if the system is shared between users in different time-zones.
使用 vbscript,
您可以在批处理文件(或命令行)中
使用 for 循环来捕获输出。 (或者你甚至可以在 vbscript 中完成所有操作)
you can use a vbscript
in your batch file (or command line)
use a for loop to catch the output. (Or you can even do everything in vbscript )