![在 Windows 中更改文件/目录的时间戳](https://linux22.com/image/484860/%E5%9C%A8%20Windows%20%E4%B8%AD%E6%9B%B4%E6%94%B9%E6%96%87%E4%BB%B6%2F%E7%9B%AE%E5%BD%95%E7%9A%84%E6%97%B6%E9%97%B4%E6%88%B3.png)
哪里可以获得适用于 Windows 的触摸实用程序?
我努力了这一个在CodeProject,但它没有改变目录。
答案1
您也可以使用 powershell 来执行此操作。我的 $profile 中有以下函数
function touch([string] $filename)
{
$curTime = Get-Date
$touchFile = get-item $filename
$touchFile.CreationTime = $curTime
$touchFile.LastAccessTime = $curTime
$touchFile.lastWriteTime = $curTime
}
答案2
有几种解决方案https://stackoverflow.com/questions/51435/windows-version-of-the-unix-touch-command
虽然大多数人建议赛格威(也是我的偏见)或者一些其他的unix实用程序,有一个答案描述了windows方法。
copy /b filename.ext +,,
同一答案的另一个简单解决方案是将 Cygwin.dll 和 touch.exe 复制到 Windows 系统本地。如果您想递归处理目录,它会更好地工作。