Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Using the same $Profile with TCC v36 and PowerShell 5.1

Aug
2,799
144
Now that TCC v36 has a PowerShell alias called tcc,
I have to distinguish on where PowerShell 5.1 was started from.

Previous to TCC v36,
I had the following function in my PowerShell $Profile;
Code:
function tcc {
        & "C:\Program Files\JPSoft\TCMD36\tcc.exe" /I /Q /C $args
    }

I have revised it to now only create my UDF if PowerShell 5.1 was not started from TCC;
Code:
if (Test-Path Alias:\tccvar) {
    # Function 'tccvar' exists.
}
else {
    function tcc {
        & "C:\Program Files\JPSoft\TCMD36\tcc.exe" /I /Q /C $args
    }
}

When running PowerShell 5.1 from Windows Terminal,
my TCC UDF gets created.

When running PowerShell 5.1 from TCC v36,
my TCC UDF does not get created.

Joe
 
Back
Top