Reputation: 23
The end of my VBScript (the rest is mainly WScript.Echo
reminders) looks like this (launches X-Plane, maximized):
Set objShell = WScript.CreateObject( "WScript.Shell" )
objShell.Run("""X:\X-Plane\X-Plane.exe"""), 3
Set objShell = Nothing
What would I need to add to this to get X-Plane to run as administrator? An hour's Googling has got me nowhere!
Upvotes: 1
Views: 7139
Reputation: 200543
Provided you have UAC enabled and your user is a member of the Administrators group you can use the ShellExecute
method with the "runas" verb:
Set app = CreateObject("Shell.Application")
app.ShellExecute "X:\X-Plane\X-Plane.exe", , , "runas", 3
Upvotes: 1