文件的增加访问时间 [英] Increment access time of file
本文介绍了文件的增加访问时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将文件的访问时间增加给定的小时数,例如12小时.
I would like to increment the access time of a file by a given number of hours, e.g. 12 hours.
我找到了一种方法,可以使用 Unxutils touch.exe
工具对其进行破解并手动计算新日期:
I found a way to hack it using Unxutils touch.exe
tool and calculate the new date manually:
touch.exe -a -t MMDDhhmmCCYY my_file.txt
但是,我想自动执行此操作而不必手动输入新日期.所以这是我的问题:
However, I would like to automatize this without having to enter the new date manually. So here are my questions:
- 如何在DOS中检索文件的访问时间?
- 如何增加它?
- 如何将它们放到脚本/批处理文件中?
- 还是有更好的方法?
非常感谢!
推荐答案
由于您已将其标记为Powershell:
Since you've got it tagged for Powershell:
$file = Get-ChildItem testfile.txt
$file.lastwritetime
$file.LastWriteTime = ($file.LastWriteTime).AddHours(12)
$file.LastWriteTime
Tuesday, November 19, 2013 5:27:18 PM
Wednesday, November 20, 2013 5:27:18 AM
这篇关于文件的增加访问时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文