9/8/10

How To Run .VBS and .JS Files As Administrator In Windows 7/Vista



If you are a user of Windows 7/Vista, you probably know how to execute .exe files as administrator by making a right-click on any .exe file and clicking on Run as administrator.




However, if you right-click on a .JS or .VBS file, Windows doesn't propose to execute the file as administrator.



To be able to run .JS and .VBS files as administrator when right-clicking on them, follow these instructions:

1. Launch the registry editor by pressing Windows Logo + R, type regedit and press Enter.

2. For .VBS files, navigate to this registry key:

HKEY_CLASSES_ROOT\VBSFile\Shell\

For .JS files, navigate to this registry key:

HKEY_CLASSES_ROOT\JSFile\Shell\

3. For both .VBS and .JS, right-click on Shell and select New >> Key.



4. Rename this key as runas.



5. Close now the registry editor and go and make a right-click on a .VBS or .JS file to see the difference now:


2 Responses to “How To Run .VBS and .JS Files As Administrator In Windows 7/Vista”

HobStarCS said...
August 6, 2011 at 3:19 AM

I did this, now when i elect "Run as Administrator" it says "This file does not have a program associated with it for performing this action. ..."

Advise?


LT said...
August 6, 2011 at 5:46 AM

There are some scripts that produce this error when executed via context menu (right-click menu). Try to execute your script using the command line. Also, you should bear in mind that some scripts don't work in elevated mode.


Post a Comment