Functions in Microsoft.PowerShell_profile.ps1

23 views
Skip to first unread message

Tom

unread,
Nov 28, 2017, 7:15:02 AM11/28/17
to
Hi,

We are running Windows 7 with PowerShell 2.0 and I'm trying to create a few aliases and functions in the Microsoft.PowerShell_profile.ps1 files so that all new shells can pick up the new alias/commands. I have the following in the file:

function sv {
$command = "C:\Program Files (x86)\IBM\RationalSDLC\ClearCase\bin\cleartool.exe"
& "$command" startview $args[0]
}
#
function ev {
$command = "C:\Program Files (x86)\IBM\RationalSDLC\ClearCase\bin\cleartool.exe"
& "$command" endview $args[0]
}

The "ev" functions works every time, however the "sv" does not. I can type the command into the terminal (using a different function name foo or bar) and it works for that shell... I've tried to change it to pass an argument in:

function sv($view) {
$command = "C:\Program Files (x86)\IBM\RationalSDLC\ClearCase\bin\cleartool.exe"
& "$command" startview $view
}

Again, starting a new Powershell terminal no luck, but typing it in on the command line it works fine. What am I doing wrong here? What am I' missing?

Thanks for any help in advance.
Tom

Tom

unread,
Nov 28, 2017, 7:35:19 AM11/28/17
to
My bad.... There already is an alias "sv"....

PS U:\> which sv

CommandType Name Definition
----------- ---- ----------
Alias sv Set-Variable


Please excuse the noise....

Tom
Reply all
Reply to author
Forward
0 new messages