powershell - 将 LastWriteTime 提前 6
问题描述
我有几个同时创建的文件目录,但时钟没有针对时区进行调整。因此,我需要将子目录中文件的 LastWriteTime 增加不同的时间(通常为 6-7 小时),以使文件在创建时保持一致。
这是一个工作示例。
Param(
[String]$fpath = '6-13',
[Int32]$addhr = 6
)
$fullpath = 'l:\pictures\europetrips\2011\alex\'
$final = -join($fullpath, $fpath)
$fx = Get-ChildItem -Path $final
foreach ($fz in $fx) {
$fz.LastWriteTime = $fz.LastWriteTime.AddHours($addhr)
}
这确实会修改LastWriteTime
并增加$addhr
时间。
一切都很好,除了我在 Windows 资源管理器中查看同一目录时,时间戳没有变化。“日期”不变。“修改日期”已更改。如何修改“日期”?
解决方案
推荐阅读
- mysql - 高版本的mysql备份恢复太慢
- python - (pip)安装后使用pyinstaller时出现无法识别的命令错误
- python - 在python中找不到类变量
- azure-cosmosdb - 使用 v4 Java SDK 依赖项连接到 CosmosDB 时出错
- php - libmemcached 版本升级问题
- openedge - 导出为 csv 文件时如何更改日期格式?
- firebase - 可以使用firebase可调用函数来构建API吗?
- javascript - 登录显示不需要的警报
- javascript - 从受信任的 Web 活动(PWA)调用 android shell 应用程序本机函数
- android - App Action 通过 App Action Tool Plugin 工作,但不能在 Google Assistant 屏幕中使用语音命令