# Define cd to work more like Unix/Linux: # * No path argument changes to the users home directory # * Passing "-" for the path argument changes to the previous directory $Global:cdPreviousPath = Get-Location function cd { Param ([string]$Path) if ($Path -eq "") { $Path = "~" } elseif ($Path -eq "-") { $Path = $cdPreviousPath } $Global:cdPreviousPath = Get-Location Set-Location -Path $Path } function rm { Param ( [Parameter( Mandatory=$true, ValueFromRemainingArguments=$true )][string[]]$Paths, [switch]$F, [switch]$Force, [switch]$R, [switch]$Recurse, [switch]$RF, [switch]$FR ) $Command = "Remove-Item" if ($F -or $Force -or $RF -or $FR) { $Command = "$Command -Force" } if ($R -or $Recurse -or $RF -or $FR) { $Command = "$Command -Recurse" } foreach ($Path in $Paths) { Invoke-Expression -Command "$Command $Path" } } # Add new aliases function touch { Param ( [string]$Path ) New-Item -Type File $Path }