PowerShell aliases can be used for any "command", including EXE:
new-alias n notepad.exe
Update : as mentioned in the comments, PowerShell aliases do not accept arguments. These are simple βaliasesβ for the team name and nothing more. To get what you need (I think, since I am not familiar with Bash aliases), try the following:
function django-admin-jy { jython.exe /path/to/jython-dev/dist/bin/django-admin.py @args }
It uses a PowerShell 2.0 function called the splatting argument. You can apply @ to a variable name that refers to either an array or a hash table. In this case, we apply it to a variable called args , which contains all the unnamed parameters.
If you need a really general way to create alias functions that take parameters, try the following:
function New-BashStyleAlias([string]$name, [string]$command) { $sb = [scriptblock]::Create($command) New-Item "Function:\global:$name" -Value $sb | Out-Null } New-BashStyleAlias django-admin-jy 'jython.exe /path/to/jython-dev/dist/bin/django-admin.py @args'
Regarding the issue with Joel's approach, I suspect it has which with the Get-Command alias. Try replacing which with Get-Command .
Keith hill
source share