KB Article #178583

Script to launch the profile in PowerShell

Problem

Is there any script to be executed in PowerShell in order to launch the CFT profile: profile.bat ?

Resolution

Yes. Create the following PowerShell script, script.ps1, and place it in "runtime".


----------------------------------------------------------------------------
param([String] $ScriptName='profile.bat')
$tempfile = [IO.Path]::GetTempFileName()
& "$ENV:Comspec" /c " ""$ScriptName"" $ARGS && set > ""$tempfile"""
get-content $tempfile | foreach-object {
if ($_ -match "^(.*?)=(.*)$") {
set-item ENV:$($MATCHES[1]) $MATCHES[2]
}
}
remove-item $tempfile
----------------------------------------------------------------------------


Execute the script in PowerShell, as it follows: .\script.ps1.

Then, after you execute this script in PowerShell, you can try to launch the command "cftutil about", to make sure that the profile.bat was loaded as expected.