• Announcements

    • xper

      MSFN Sponsorship and AdBlockers!   07/10/2016

      Dear members, MSFN is made available via subscriptions, donations and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, become a site sponsor and ads will be disabled automatically and by subscribing you get other sponsor benefits.
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.