How to open an elevated cmd using command line for Windows?

后端 未结 23 1576
既然无缘
既然无缘 2020-12-04 06:21

How do I open a elevated command prompt using command lines on a normal cmd?

For example, I use runas /username:admin cmd but the cmd that was opened do

23条回答
  •  南方客
    南方客 (楼主)
    2020-12-04 06:51

    I've been using Elevate for awhile now.

    It's description - This utility executes a command with UAC privilege elevation. This is useful for working inside command prompts or with batch files.

    I copy the bin.x86-64\elevate.exe from the .zip into C:\Program Files\elevate and add that path to my PATH.

    Then GitBash I can run something like elevate sc stop W3SVC to turn off the IIS service.

    Running the command gives me the UAC dialog, properly focused with keyboard control and upon accepting the dialog I return to my shell.

提交回复
热议问题