Start-Process -WorkingDirectory as administrator does not set location

When i enter the team

Start-Process powershell -WorkingDirectory "D:\folder"

it opens a new PowerShell window with location settings D:\folder.

But when I enter the team

Start-Process powershell -WorkingDirectory "D:\folder" -Verb RunAs

it opens a new PowerShell window with administrator privileges , but with a location setting C:\Windows\system32.

How can I open a new PowerShell admin window and determine my own location?

+6
source share
1 answer

After starting Powershell as an administrator;

enter the push-location command:

Push-Location -Path C:\

or put it in your script and run the script from the Powershell extended prompt.

+2
source

Source: https://habr.com/ru/post/1016627/


All Articles