Public/Add-Item.ps1
function Add-Item { [CmdletBinding()] param( [Parameter(Mandatory = $true)] [string] $fileName, [switch] $force ) if ($(Test-Path -Path $filename) -and $force.IsPresent -eq $false) { (Get-ChildItem -Path $filename).LastWriteTime = Get-Date } else { # Out-Null is used to prevent the New-Item -ItemType File -Name $fileName -Force:$force.IsPresent | Out-Null } } Set-Alias touch Add-Item |