super1337 Posted March 31, 2014 Posted March 31, 2014 I am trying to run an application that requires UAC to elevate permissions with command line parameters... I tried the following: If Not IsAdmin() Then Global $CmdArgList For $i = 1 To $cmdLine[0] $CmdArgList = $CmdArgList & ' ' & $cmdLine[$i] Next ShellExecute(@AutoItExe & $CmdArgList, "", "", "runas") ProcessClose(@AutoItPID) Exit EndIf It passes all the command line parameters to shell execute so that when it runs as admin, it still has the initial parameters. Unfortunately this does not work as it complains that Windows cannot find the exe file. Apparently it doesn't like command line parameters being passed to it. Is there a correct way to do something like this?
Solution super1337 Posted March 31, 2014 Author Solution Posted March 31, 2014 (edited) I just found the answer... whoops. There is a command line option for Shell execute. The following fix works: If Not IsAdmin() Then Global $CmdArgList For $i = 1 To $cmdLine[0] $CmdArgList = $CmdArgList & ' ' & $cmdLine[$i] Next ShellExecute(@AutoItExe, $CmdArgList, "", "runas") ProcessClose(@AutoItPID) Exit EndIf Edited March 31, 2014 by super1337
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now