What is a proper way to pass a parameter to Set-Alias in powershell?

Posted by Nick Gorbikoff on Stack Overflow See other posts from Stack Overflow or by Nick Gorbikoff
Published on 2010-04-20T18:08:51Z Indexed on 2010/04/20 18:13 UTC
Read the original article Hit count: 706

Filed under:
|
|
|

Hello.

A little background:

I use PowerShell on windows xp at work and I set a bunch of useful shortcuts in Microsoft.PowerShell_profile.ps1 in My Documents, trying to emulate Mac environment inspired by Ryan Bates's shortcuts

I have things like:

Set-Alias rsc Rails-Console
function Rails-Console {Invoke-Expression "ruby script/console"}

Which works just fine when in command prompt I say:

rsc #it calls the proper command

However this doesn't work properly

Set-Alias rsg Rails-Generate
function Rails-Generate {Invoke-Expression "ruby script/generate"}

So when I do :

rsg model User

which is supposed to call

ruby script/generate model User

all it calls is

ruby script/generate  #Dumping  my params

So how would I properly modify my functions to take params I send to functions?

Thank you!!

© Stack Overflow or respective owner

Related posts about ryan-bates

Related posts about powershell