behdadsoft Posted May 5, 2013 Share Posted May 5, 2013 (edited) Hi.I want run my exe file as administrator after finished installing Windows. I call it with this command in SetupComplete.cmd ("%~dp0Setup.exe"), but after run don't work correctly because need run as admin. how can run it as admin?Please Guide me.THANKS Edited May 5, 2013 by behdadsoft Link to comment Share on other sites More sharing options...
allen2 Posted May 5, 2013 Share Posted May 5, 2013 Did you tried to add:set __COMPAT_LAYER=RunAsInvokerAt the begining of your batch ? Link to comment Share on other sites More sharing options...
behdadsoft Posted May 5, 2013 Author Share Posted May 5, 2013 (edited) OK Thanks.I try it. Edited May 5, 2013 by behdadsoft Link to comment Share on other sites More sharing options...
behdadsoft Posted May 5, 2013 Author Share Posted May 5, 2013 I add set __COMPAT_LAYER=RunAsInvoker command in the begining of batch file, But don't work. Link to comment Share on other sites More sharing options...
allen2 Posted May 5, 2013 Share Posted May 5, 2013 Then you might need to impersonnate Trusted installer as explained there. Link to comment Share on other sites More sharing options...
MagicAndre1981 Posted May 5, 2013 Share Posted May 5, 2013 disable UAC (set EnableLUA to 0) install all programs, in the last step activate UAC again and reboot Windows. Link to comment Share on other sites More sharing options...
odar Posted May 8, 2013 Share Posted May 8, 2013 (edited) runas /user:administrator /savecred "%~dp0Setup.exe"runas /user:%username% /savecred "%~dp0Setup.exe"runas /user:%computername%\%username% /savecred cmdrunas /user:%computername%\%username% /savecred "%~dp0Setup.exe"PowerShell -Command (New-Object -com 'Shell.Application').ShellExecute('"%~dp0\Setup.exe', '', 'runas')oder run batfile to drag &drop %1PowerShell -Command (New-Object -com 'Shell.Application').ShellExecute('Cmd.exe', '/c \"\"%userprofile%\\Desktop\\Nuova cartella (2)\\mybatfile.bat\" \"%1\"\" ', '', 'runas')PowerShell -Command (New-Object -com 'Shell.Application').ShellExecute('%userprofile%\\Desktop\\Nuova cartella (2)\\mybatfile.bat', ' \"%1\" ', '', 'runas') Edited May 9, 2013 by odar Link to comment Share on other sites More sharing options...
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