Posh-Alias.psm1
<#
Add Alias #> function Add-Alias($name, $alias) { $func = @" function global:$name { `$expr = ('$alias ' + (( `$args | % { if (`$_.GetType().FullName -eq "System.String") { "``"`$(`$_.Replace('``"','````"').Replace("'","``'"))``"" } else { `$_ } } ) -join ' ')) write-debug "Expression: `$expr" Invoke-Expression `$expr } "@ write-debug "Defined function:`n$func" $func | iex } |