Can't open elevated prompt and pass working directory

Welcome Forums General PowerShell Q&A Can't open elevated prompt and pass working directory

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
2 years, 9 months ago.

  • Author
    Posts
  • #33798

    Participant
    Points: 0
    Rank: Member
    Start-Process Powershell -Verb RunAs -WorkingDirectory C:\

    This won't open to the set working directory. Anyone know how to get this working?

  • #33799

    Member
    Points: 0
    Rank: Member

    That's probably a security feature of some sort. I've noticed that my elevated prompts always show up in the \windows\system32 directory. Instead of -WorkingDirectory C:\, try -ArgumentList '-NoExit -Command Set-Location C:\'

  • #33801

    Participant
    Points: 0
    Rank: Member

    That does it. Thanks!

The topic ‘Can't open elevated prompt and pass working directory’ is closed to new replies.