February 27, 2018

Touch Command on Windows

Windows still doesn't include touch command... A quick search on Google brings up several posts in StackOverflow, and PowerShell seems to be the best option. With Microsoft now letting you run Linux natively on Windows, perhaps it will never be included in Windows itself.

Examples:

PS C:\> $(Get-Item ".\UseCurrentDateTime.txt").LastWriteTime=$(Get-Date)
PS C:\> $(Get-Item ".\UseSpecificDateTime.txt").LastWriteTime=$(Get-Date "2/26/2018 9:00 PM")

Use the tab key for auto-completion.

Other properties: CreationTime, LastAccessTime

No comments:

Post a Comment