You can use
$file = Get-Item C:IntelLogsIntelCpHDCPSvc.log
$file.LastWriteTime = (Get-Date)
Or CreationTime or LastAcccessTime, if you prefer.
As a function
Function UpdateFileLastWriteTimeToToday() {
Param ($FileName)
$file = Get-Item $FileName
Echo "Current last write time: " $file.LastWriteTime
$file.LastWriteTime = (Get-Date)
Echo "New last write time: " $file.LastWriteTime
}
#How to use
UpdateFileLastWriteTimeToToday -FileName C:IntelLogsIntelGFX.Log
With the output of
Current last write time:
Tuesday, April 16, 2019 1:09:49 PM
New last write time:
Monday, November 4, 2019 9:59:55 AM
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…