Jump to content

Recommended Posts

Posted

Hi everyone !

I have a program A in drive C, I make a script to run program A . How can I run program A as administrator when I run my script ? Thanks !

Posted

Look at RunAs in the Help file.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

If you have differernt creadentials on each computer you're screwed.

Or you could ask the user for the administrator password. Just use InputBox.

There is no way to elevate the rights without the RusAsAdmin() function, as guinness already stated.

Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
Posted (edited)

_RunDOS perhaps, that's if you want to run a DOS command, though I think your question was directed towards hannes08 so sorry for answering. :D

Edited by guinness

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted (edited)

maybe this will help you

If Not IsAdmin() Then
    ShellExecute(@AutoItExe, "", "", "runas")
    ProcessClose(@AutoItPID)
    Exit
Else
    MsgBox(64, "1", "IsAdmin() = " & IsAdmin())
    RunWait(@WindowsDir & "\regedit.exe", @WindowsDir, @SW_MAXIMIZE)
EndIf

MsgBox(64, "2", "IsAdmin() = " & IsAdmin() & @LF & $CmdLineRaw)    ; ShellExecute(@AutoItExe, "ect ect ect", "", "runas")
RunWait(@WindowsDir & "\regedit.exe", @WindowsDir, @SW_MAXIMIZE)

Ciao.

Edited by DXRW4E

apps-odrive.pngdrive_app_badge.png box-logo.png new_logo.png MEGA_Logo.png

  • 1 year later...
Posted

  On 11/10/2011 at 8:07 PM, 'DXRW4E said:

maybe this will help you

If Not IsAdmin() Then
    ShellExecute(@AutoItExe, "", "", "runas")
    ProcessClose(@AutoItPID)
    Exit
Else
    MsgBox(64, "1", "IsAdmin() = " & IsAdmin())
    RunWait(@WindowsDir & "regedit.exe", @WindowsDir, @SW_MAXIMIZE)
EndIf

MsgBox(64, "2", "IsAdmin() = " & IsAdmin() & @LF & $CmdLineRaw) ; ShellExecute(@AutoItExe, "ect ect ect", "", "runas")
RunWait(@WindowsDir & "regedit.exe", @WindowsDir, @SW_MAXIMIZE)

Ciao.

omg thank's so much ! x)

  • 2 years later...

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.
×
×
  • Create New...