diff --git a/src/chocolatey.resources/helpers/functions/Install-ChocolateyInstallPackage.ps1 b/src/chocolatey.resources/helpers/functions/Install-ChocolateyInstallPackage.ps1 index c34c499ba8..069f2e6d0e 100644 --- a/src/chocolatey.resources/helpers/functions/Install-ChocolateyInstallPackage.ps1 +++ b/src/chocolatey.resources/helpers/functions/Install-ChocolateyInstallPackage.ps1 @@ -261,11 +261,15 @@ Start-ChocolateyProcessAsAdmin $additionalInstallArgs = ''; } else { - if ($additionalInstallArgs -match 'INSTALLDIR' -or ` - $additionalInstallArgs -match 'TARGETDIR' -or ` - $additionalInstallArgs -match 'dir\=' -or ` - $additionalInstallArgs -match '\/D\=' - ) { + #Use a Regex Or ('|') to do the match, instead of multiple '-or' clauses + $argPattern = @( + 'INSTALLDIR' + 'TARGETDIR' + 'dir\=' + '\/D\=' + ) -join '|' + + if ($additionalInstallArgs -match $argPattern) { @" Pro / Business supports a single, ubiquitous install directory option. Stop the hassle of determining how to pass install directory overrides