in reply to Re: $^O empty in windows powershell -- portableshell.bat ?
in thread $^O empty in windows powershell

you have to distinguish between console/terminal-window and a shell running within°, and you can run multiple shells nested within each other.²

in your case portableshell.bat starts a fresh cmd° shell as a sub-process inside the current terminal window, after typing exit you'll be back to the outer powershell.

compare

C:\tmp> C:\tmp>cmd # new sub shell Microsoft Windows [Version 10.0.19044.2251] (c) Microsoft Corporation. Alle Rechte vorbehalten. C:\tmp>exit # leave sub shell C:\tmp>

vs

C:\tmp>start cmd # new window with su +b shell C:\tmp>

Cheers Rolf
(addicted to the 𐍀𐌴𐍂𐌻 Programming Language :)
Wikisyntax for the Monastery

°) that's mostly *nix speak, not sure how they call these on win

²) the motivation for the name "shell" is a surrounding process managing an environment for sub-processes