Set-FileExistance.ps1
function Set-FileExistance { [alias('touch')] param( [Parameter( position=0, HelpMessage='Enter file names to touch', ValueFromRemainingArguments, Mandatory)] [string[]]$path ) foreach ($P in $path) { try { # Make item New-Item -Path $P } catch [IO.IOException]{ # Update Write Time Get-ChildItem -path $P | ForEach-Object {$_.LastWriteTime = Get-Date} Get-ItemProperty $P } } } |