And have gotten the following syntax-related error on loading up powershell:

The term 'which' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spell
ing of the name, or if a path was included, verify that the path is correct and try again.
At C:\Users\Dan\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1:9 char:27
+ $cmd = @(which <<<< $_.Content)[0]
+ CategoryInfo : ObjectNotFound: (which:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

2 Answers
2

Update: as mentioned in the comments, PowerShell aliases do not allow for arguments. They are simple "aliases" for a command name and nothing more. To get what you after (I think since I'm not familiar with Bash aliases) try this:

It uses a feature of PowerShell 2.0 called argument splatting. You can apply @ to a variable name that references either an array or a hashtable. In this case, we apply it to the variable named args which contains all the unnamed parameters.

If you want a truly generic way to create aliases functions that take parameters, try this:

Hi Kieth, The New-Alias command does not appear to allow arguments to be specified for the executable. (Maybe I'm wrong?) Also, I'm not worried about getting the prompt back immediately, I just want "django-admin-jy help" to behave exactly like "jython /path/to/jython-dev/dist/bin/django-admin.py help" (And, of course, have the ability to specify any other argument as well.) Not to seem lazy (I've been tinkering with this for some time), but I think that seeing a complete function for bash alias simulation might be the most helpful for everyone.
–
RightFullRudderMar 21 '10 at 19:34

Kieth, Your first answer worked! The second one resulted in an error (too big to paste here), but I'm content with just using the first (not much extra syntax), and am awarding you the bounty.
–
RightFullRudderMar 24 '10 at 6:23

I fixed the issue with the second approach (had some left-over code from a previous try).
–
Keith HillMar 24 '10 at 19:26

1

One benefit with using functions is that you get auto-complete for argument names (press tab after -) that you don't get for aliases set with the generic New-BashStyleAlias. Defining functions is a little bit more verbose but it shouldn't be a problem in profile scripts.
–
oradApr 9 at 18:54