Improve functions that detect ProgramFiles in powershell

This commit is contained in:
Alexander Karatarakis 2017-02-24 14:30:56 -08:00
parent e4ff363f5c
commit 60e67651c3
2 changed files with 18 additions and 6 deletions

View File

@ -3,9 +3,15 @@ param(
)
if (Test-Path env:PROGRAMFILES`(X86`))
$out = ${env:PROGRAMFILES(X86)}
if ($out -eq $null)
{
return ${env:PROGRAMFILES(X86)}
$out = ${env:PROGRAMFILES}
}
return ${env:PROGRAMFILES}
if ($out -eq $null)
{
throw "Could not find [Program Files 32-bit]"
}
return $out

View File

@ -3,9 +3,15 @@ param(
)
if (Test-Path env:ProgramW6432)
$out = ${env:ProgramW6432}
if ($out -eq $null)
{
return ${env:ProgramW6432}
$out = ${env:PROGRAMFILES}
}
return ${env:PROGRAMFILES}
if ($out -eq $null)
{
throw "Could not find [Program Files Platform Bitness]"
}
return $out