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

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

    I'm not sure the tool ExecElevated.exe (13KB) will do the job....but it might. Or at least be useful for others with similar needs who came to this page as I did (but I didn't find the solution so I ended up creating the tool myself in .Net).

    It will execute an application with elevated token (in admin mode). But you will get an UAC dialog to confirm! (maybe not if UAC has been disabled, haven't tested it).

    And the account calling the tool must also have admin. rights of course.

    Example of use:

    ExecuteElevated.exe "C:\Utility\regjump.exe HKCU\Software\Classes\.pdf"
    

提交回复
热议问题