I'm making a powershell installation script for an app at work and I'm constantly switching from PowerShell ISE to PowerGUI to make it.
I found a difference between them I really can't explain and I'd like to have some advice.
For the same following code :
$test = ""
$feedback = $FALSE
try
{
$test = [System.Environment]::GetFolderPath([Environment+SpecialFolder]::ProgramFilesX86)
}
catch
{
$test = ""
}
if($test -eq "")
{
$feedback = $TRUE
}
else
{
$feedback = $FALSE
}
"Feedback : " + $feedback
"Result : " + $test
Powershell ISE returns :
Feedback : True
Result :
And PowerGUI returns :
Feedback : False
Result : C:\Program Files (x86)
Of course, C:\Program Files (x86) is an existing folder.
I'm curious to understand why. Thanks.