• Functions in Microsoft.PowerShell_profile.ps1

    From Tom@21:1/5 to Tom on Tue Nov 28 04:35:18 2017
    On Tuesday, November 28, 2017 at 7:15:02 AM UTC-5, Tom wrote:
    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

    My bad.... There already is an alias "sv"....

    PS U:\> which sv

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


    Please excuse the noise....

    Tom

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)