Welcome to MSFN

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.


behdadsoft

run as admin

7 posts in this topic

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 by behdadsoft
0

Share this post


Link to post
Share on other sites

Did you tried to add:

set __COMPAT_LAYER=RunAsInvoker

At the begining of your batch ?

0

Share this post


Link to post
Share on other sites

OK Thanks.

I try it.

Edited by behdadsoft
0

Share this post


Link to post
Share on other sites

I add set __COMPAT_LAYER=RunAsInvoker command in the begining of batch file, But don't work. :(

0

Share this post


Link to post
Share on other sites

Then you might need to impersonnate Trusted installer as explained there.

0

Share this post


Link to post
Share on other sites

disable UAC (set EnableLUA to 0) install all programs, in the last step activate UAC again and reboot Windows.

0

Share this post


Link to post
Share on other sites

runas /user:administrator /savecred "%~dp0Setup.exe"

runas /user:%username% /savecred "%~dp0Setup.exe"

runas /user:%computername%\%username% /savecred cmd

runas /user:%computername%\%username% /savecred "%~dp0Setup.exe"

PowerShell -Command (New-Object -com 'Shell.Application').ShellExecute('"%~dp0\Setup.exe', '', 'runas')

oder run batfile to drag &drop %1

PowerShell -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 by odar
0

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.