blksith0

Extraordinary Member
Joined
Oct 24, 2012
Messages
61
Hi,
I'd to make my cmd open as an administrator by default. I know I can hit Win+X->'a', but I want to open the admin-cmd anywhere. Normally I open cmd in a folder either by:
1. Typing 'cmd' into Windows Explorer url bar [preferred method]
2. shift+right-click -> open cmd as administrator

So, can we find where this behavior is defined and make it open an admin-cmd instead? (preferably #1 but both would be nice)

----Alternatively----
If it's easily possible to add a command that I can type that will convert the current cmd to admin-cmd, that might be easier than modifiying the above^. (Like putting su.exe into System32)


And finally, if you guys know a better way to open an admin cmd quickly into any folder, let me know too.
Thanks
 


Solution
I wouldn't recommend always opening cmd as admin for security reasons. The easiest way to open command prompt with elevated rights is hold ctrl+shift and left click command prompt.

If you really really want it to always be elevated you can embed a manifest into cmd.exe or a copy of it and pin it to taskbar or start menu
How to: Embed a Manifest Inside a C-C++ Application you'll need to add invoke asAdministrator

Sample manifest from User Account Control for Game Developers (Windows)
<ms_asmv2:trustInfo xmlns:ms_asmv2="urn:schemas-microsoft-com:asm.v2">
<ms_asmv2:security>
<ms_asmv2:requestedPrivileges>
<ms_asmv2:requestedExecutionLevel level="requireAdministrator">
</ms_asmv2:requestedExecutionLevel>...
I wouldn't recommend always opening cmd as admin for security reasons. The easiest way to open command prompt with elevated rights is hold ctrl+shift and left click command prompt.

If you really really want it to always be elevated you can embed a manifest into cmd.exe or a copy of it and pin it to taskbar or start menu
How to: Embed a Manifest Inside a C-C++ Application you'll need to add invoke asAdministrator

Sample manifest from User Account Control for Game Developers (Windows)
<ms_asmv2:trustInfo xmlns:ms_asmv2="urn:schemas-microsoft-com:asm.v2">
<ms_asmv2:security>
<ms_asmv2:requestedPrivileges>
<ms_asmv2:requestedExecutionLevel level="requireAdministrator">
</ms_asmv2:requestedExecutionLevel>
</ms_asmv2:requestedPrivileges>
</ms_asmv2:security>
</ms_asmv2:trustInfo>

The other option is to install a code shim to force the UAC with the Microsoft ACT toolkit.
 


Solution
Back
Top