Jump to content

RunAs problem


Recommended Posts

RunAs("test", @ComputerName, "admin", 0, @AutoItExe, @WorkingDir, @SW_SHOWDEFAULT)
RunAs("test", @ComputerName, "admin", 0, "notepad.exe", @WorkingDir, @SW_SHOWDEFAULT)

The first line does not work, but the second does.

I've tried using the older RunAsSet with Run, and I get an error that the directory name is invalid.

EDIT: I tested this line

RunAs("test", @ComputerName, "admin", 0, "cmd /c pause|start " & @AutoItExe, @WorkingDir, @SW_SHOWDEFAULT)
And the command prompt said "Access is denied." Edited by daslick
Link to comment
Share on other sites

  • Developers

You are trying this with a compiled script ...right?

Try:

RunAs("test", @ComputerName, "admin", 0, @AutoItExe, "", @SW_SHOWDEFAULT)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

You could also try something like this:

If Not IsAdmin() Then
    RunAsSet("USERNAME", @ComputerName, "PASSWORD")
    If @Compiled Then
        Run('"' & @ScriptFullPath & '"')
        Exit
    EndIf
EndIf

[sub]Quantum mechanics: The dreams stuff is made of[/sub]

Link to comment
Share on other sites

  • Developers

Not really when using the latest Beta which I assume the OP is using looking at the RunAs() statement. :)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Tested. With your code I'm getting an Autoit error

You may need to set a working directory which is valid for access.

RunAs("test", @ComputerName, "admin", 0, '"' & @AutoItExe & '"', @TempDir, @SW_SHOWDEFAULT)

And some quotes may help as well.

:)

Link to comment
Share on other sites

Has anyone else with Autoit Beta 3.2.11.4 tried this? None of the examples posted here are working for me.

EDIT: I STILL have been unable to find a way to have my script use a RunAs/RunAsSet+Run command on itself with this version of Autoit. Help??

Edited by daslick
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...