diff --git a/winscripts/gccsetup.ps1 b/winscripts/gccsetup.ps1 index 97fb712f2..a5ac71784 100644 --- a/winscripts/gccsetup.ps1 +++ b/winscripts/gccsetup.ps1 @@ -161,7 +161,10 @@ if ((! ($env:plain_prompt)) -or ($env:plain_prompt -ne "Y")) $prompt_existing = (Get-Command prompt).ScriptBlock if ($prompt_existing) { $prompt_current=(prompt) - if (! ($prompt_current.SubString(0, 3) -eq "GCC")) { + if ((!$prompt_current) -or ($prompt_current.length -lt 3)) { + function global:prompt {"MVS> "} + } + elseif (! ($prompt_current.SubString(0, 3) -eq "GCC")) { $prompt_new = "`"GCC `" + " + $prompt_existing $def_fn_prompt_new = ` "function global:prompt { " + $prompt_new + " }" diff --git a/winscripts/msvcsetup.ps1 b/winscripts/msvcsetup.ps1 index 2ffd19763..ee75066aa 100644 --- a/winscripts/msvcsetup.ps1 +++ b/winscripts/msvcsetup.ps1 @@ -257,7 +257,10 @@ if ((! ($env:plain_prompt)) -or ($env:plain_prompt -ne "Y")) $prompt_existing = (Get-Command prompt).ScriptBlock if ($prompt_existing) { $prompt_current=(prompt) - if (! ($prompt_current.SubString(0, 3) -eq "MVS")) { + if ((!$prompt_current) -or ($prompt_current.length -lt 3)) { + function global:prompt {"MVS> "} + } + elseif (! ($prompt_current.SubString(0, 3) -eq "MVS")) { $prompt_new = "`"MVS `" + " + $prompt_existing $def_fn_prompt_new = ` "function global:prompt { " + $prompt_new + " }"