Running a command as Administrator using PowerShell?

后端 未结 26 3392
粉色の甜心
粉色の甜心 2020-11-22 09:41

You know how if you\'re the administrative user of a system and you can just right click say, a batch script and run it as Administrator without entering the administrator p

26条回答
  •  清歌不尽
    2020-11-22 10:10

    On top of Shay Levy's answer, follow the below setup (just once)

    1. Start a PowerShell with Administrator rights.
    2. Follow Stack Overflow question PowerShell says “execution of scripts is disabled on this system.”.
    3. Put your .ps1 file in any of the PATH folders, for example. Windows\System32 folder

    After the setup:

    1. Press Win + R
    2. Invoke powershell Start-Process powershell -Verb runAs

    You can now run everything in just one command line. The above works on Windows 8 Basic 64-bit.

提交回复
热议问题