如何使用批处理文件更改 Windows 中文件的“已修改”时间戳?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5686007/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 16:39:54  来源:igfitidea点击:

How do I change the 'modified' timestamp of a file in Windows using a batch file?

windowsfilebatch-file

提问by Michiel Borkent

How do I change the 'modified' timestamp of a file in Windows using a batch file?

如何使用批处理文件更改 Windows 中文件的“已修改”时间戳?

回答by Robin Green

If you have cygwin installed and on the PATH you can use the touchcommand:

如果您安装了 cygwin 并且在 PATH 上,您可以使用以下touch命令:

touch -d "date and time" filename

touch -d "date and time" filename

(omit the -d flag to use the current date and time.)

(省略 -d 标志以使用当前日期和时间。)

Alternatively, see the answers to this question: https://stackoverflow.com/questions/51435/windows-version-of-the-unix-touch-command

或者,请参阅此问题的答案:https: //stackoverflow.com/questions/51435/windows-version-of-the-unix-touch-command