Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account


Photo

run as admin


  • Please log in to reply
6 replies to this topic

#1
behdadsoft

behdadsoft

    Member

  • Member
  • PipPip
  • 113 posts
  • OS:Windows 8.1 x64
  • Country: Country Flag
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, 05 May 2013 - 12:36 AM.



How to remove advertisement from MSFN

#2
allen2

allen2

    Not really Newbie

  • Member
  • PipPipPipPipPipPipPip
  • 1,812 posts
Did you tried to add:
set __COMPAT_LAYER=RunAsInvoker
At the begining of your batch ?

#3
behdadsoft

behdadsoft

    Member

  • Member
  • PipPip
  • 113 posts
  • OS:Windows 8.1 x64
  • Country: Country Flag
OK Thanks.

I try it.

Edited by behdadsoft, 05 May 2013 - 03:08 AM.


#4
behdadsoft

behdadsoft

    Member

  • Member
  • PipPip
  • 113 posts
  • OS:Windows 8.1 x64
  • Country: Country Flag
I add set __COMPAT_LAYER=RunAsInvoker command in the begining of batch file, But don't work. :(

#5
allen2

allen2

    Not really Newbie

  • Member
  • PipPipPipPipPipPipPip
  • 1,812 posts
Then you might need to impersonnate Trusted installer as explained there.

#6
MagicAndre1981

MagicAndre1981

    after Windows 7 GA still Vista lover :)

  • Patrons
  • 5,926 posts
  • OS:Vista Ultimate x86
  • Country: Country Flag

Donator

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

#7
odar

odar

    Newbie

  • Member
  • 11 posts
  • OS:Windows 8 x64
  • Country: Country Flag
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, 08 May 2013 - 09:06 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users



How to remove advertisement from MSFN