behdadsoft Posted May 5, 2013 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
allen2 Posted May 5, 2013 Posted May 5, 2013 Did you tried to add:set __COMPAT_LAYER=RunAsInvokerAt the begining of your batch ?
behdadsoft Posted May 5, 2013 Author Posted May 5, 2013 (edited) OK Thanks.I try it. Edited May 5, 2013 by behdadsoft
behdadsoft Posted May 5, 2013 Author Posted May 5, 2013 I add set __COMPAT_LAYER=RunAsInvoker command in the begining of batch file, But don't work.
allen2 Posted May 5, 2013 Posted May 5, 2013 Then you might need to impersonnate Trusted installer as explained there.
MagicAndre1981 Posted May 5, 2013 Posted May 5, 2013 disable UAC (set EnableLUA to 0) install all programs, in the last step activate UAC again and reboot Windows.
odar Posted May 8, 2013 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
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now