Remove repeated $WinUtilLaunchArguments re-assignment in Start-LatestWinUtil

This commit is contained in:
Cryostrixx 2024-09-23 11:15:37 -07:00
parent af2fd17afb
commit 73aa021957
No known key found for this signature in database
GPG Key ID: 2FC11420AFB82801

View File

@ -121,10 +121,9 @@ function Start-LatestWinUtil {
# Setup the script's launch arguments based on the presence of Windows Terminal or Windows PowerShell/PowerShell Core:
# 1. Windows Terminal needs the name of the process to start ($PowerShellCommand) in addition to the launch arguments.
# 2. Windows PowerShell and PowerShell Core can receive and use the launch arguments as is without extra modification.
$WinUtilLaunchArguments = "-ExecutionPolicy Bypass -NoProfile -File `"$WinUtilScriptPath`""
if ($ProcessCommand -ne $PowerShellCommand) {
$WinUtilLaunchArguments = "$PowerShellCommand -ExecutionPolicy Bypass -NoProfile -File `"$WinUtilScriptPath`""
} else {
$WinUtilLaunchArguments = "-ExecutionPolicy Bypass -NoProfile -File `"$WinUtilScriptPath`""
$WinUtilLaunchArguments = "$PowerShellCommand $WinUtilLaunchArguments"
}
# If WinUtil's launch arguments are provided, append them to the end of the list of current launch arguments.