My powershell script contain a 'set-location' (cd) command. After running the script, my current directory is changed, but I don't want it that way.
test.ps1:
cd d:\temp (new line)
myProgram (new line)
(eof)
Those 'new line', 'eof' are markings only.
PowerShell console:
PS D:\projects\abc> .\test.ps1
This line is the output of myProgram
PS D:\temp> _
I need my PowerShell console stay in d:\projects\abc instead of being at d:\temp after running the script. Any quick solution?
I can not just run d:\temp\myProgram because myProgram is only working in that d:\temp directory. And also, I can't put "cd d:\projects\abc" after executing myProgram in test.ps1 as myProgram is a web server which I have to terminate when I want using Ctrl+C.
pushd d:\temp; myProgram; popd