When I right click on some .bat
files the "run as administrator" selection is bold. Why is this?
How do I make it so that all .bat
files act that way too?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Sign up to join this communityIndividual .BAT
files can be configured to always Run as administrator by creating a shortcut to the batch file and modifying the shortcut's properties. Here's how:
On the Shortcut tab click Advanced
Select the Run as administrator checkbox
Click OK twice to save and exit
The solution above is great if you don't mind all the extra steps. But why work so hard? You can configure all .BAT
files to default to the Run as administrator option. It only requires a simple registry edit:
Save the following code snippet into a file named DefaultToRunas.reg
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\batfile\shell]
@="runas"
Double-click the DefaultToRunas.reg
file to merge the settings into the Windows Registry
Click Yes to merge the changes into the Registry
Notes:
You can use this registry edit to change the default for other file types as well. For example, to make Run as administrator the default action for command files (.CMD
), substitute the following registry file in Step 1 above:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\cmdfile\shell]
@="runas"
You can read more about manipulating the Windows Context menu in this MSDN article.
.bat
files behave the same way?