Let's say I have a simple powershell script:
# File: myscript.ps1
set-location C:\Windows
Then I invoke this script from the prompt as follows:
PS> Get-Location
C:\User\Dude
PS> .\myscript.ps1
PS> Get-Location
C:\Windows #!!!!!!!!!
I don't want my script to change the calling shells path... how to prevent this? Can I put something in the code to turn off exporting the PATH to the parent? or is there a way to somehow set it back to the original value before exiting the script, either on error or normal termination?