PoweShell TTUC (Tips, Tricks and Useful Commands) #16 – File Name with Time Stamp
File can be created with date / time suffix using the following syntax / commands:
New-item -type file -Name (“MyFile_$(Get-Date -f MM-dd-yyyy_hh-mm-ss).txt”) –force
New-item cmdlet will create a new file. Get-data cmdlet will append date and time in MM-dd-yyyy_hh-mm-ss format.
Powered by WPeMatico