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

后端 未结 23 1581
既然无缘
既然无缘 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:44

    According to documentation, the Windows security model...

    does not grant administrative privileges at all times. Even administrators run under standard privileges when they perform non-administrative tasks that do not require elevated privileges.

    You have the Create this task with administrative privileges option in the Create new task dialog (Task Manager > File > Run new task), but there is no built-in way to effectively elevate privileges using the command line.

    However, there are some third party tools (internally relying on Windows APIs) you can use to elevate privileges from the command line:

    NirCmd:

    1. Download it and unzip it.
    2. nircmdc elevate cmd

    windosu:

    1. Install it: npm install -g windosu (requires node.js installed)
    2. sudo cmd

提交回复
热议问题