Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to create two context menus for .EXE files in Windows 8, both of which will need admin privileges. As I can see in registry, HKEY_CLASSES_ROOT\exefile\shell\runas can only have one command and it is being used by the "Run as administrator" context menu. Right now, I am using this code in a .reg file:

[HKEY_CLASSES_ROOT\exefile\shell\Low Priority Run]
"HasLUAShield"=""
"MUIVerb"="&Low Resource Start"

[HKEY_CLASSES_ROOT\exefile\shell\Low Priority Run\command]
@="cmd.exe /c start /low /affinity 2 \"\" \"%1\""

[HKEY_CLASSES_ROOT\exefile\shell\Boost Application]
"HasLUAShield"=""
"MUIVerb"="&Boost Application"

[HKEY_CLASSES_ROOT\exefile\shell\Boost Application\command]
@="cmd.exe /c start /realtime \"\" \"%1\""

The HasLUAShield flag seems to be only displaying fancy shield and is not elevating my command to run as administrator.

Why I want them to be ran as administrator? Because when not ran as administrator, the "realtime" priority is not given, instead just "high" priority is allotted to the exe in the Boost Application menu. And in the Low Resource Start too, the exe files contained in (for example, Program Files folder) run as just normal (Not even low priority, neither CPU 1 Affinity).

Also, I noticed in some "command" entries in registry, there is a %* at the end. What does that %* mean?

share|improve this question
    
HasLUAShield does not elevate. It merely says that you want the decoration. If you want to elevate, then you need to do the elevation yourself, say by calling ShellExecuteEx with the runas verb. –  Raymond Chen Mar 23 '13 at 13:51
    
%* is batch for "all of the command-line arguments" –  Peter Wright Mar 23 '13 at 14:05
    
@RaymondChen, means it is impossible about what I am trying without using/creating another program to handle it? Because it would rather slowdown the start of program in the Boost Application menu. –  Ajay Raghav Mar 23 '13 at 14:54
    
@PeterWright, thanks. That means %* would simply transfer the arguments passed onto the original file that is launched. –  Ajay Raghav Mar 23 '13 at 14:56
    
StackOverflow is for programming problems. If you don't want to do programming, then try Superuser. –  Raymond Chen Mar 23 '13 at 15:44
show 1 more comment

migrated from stackoverflow.com Mar 23 '13 at 19:15

This question came from our site for professional and enthusiast programmers.

1 Answer

Hey there I managed to go around this problem of yours by :

  1. Create a copy of cmd.exe named cmd1.exe. Go with both C:\Windows\System32 and C:\Windows\SysWOW64.
  2. In the Compatibility tab of the cmd1.exe, check Run this program as an administrator in Properties menu.
  3. Change the registry keys of yours from cmd.exe to cmd1.exe.
  4. Run a program through your Boost Application context and a UAC confirmation pops up and there you go. I guess there must be a command or argument you can use but,this is a good way to effortless by-pass your problem! Worked fine on my VM machine running Windows 8.1.
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.