Jump to content

Recommended Posts

Posted

Extracted from a script by: Author: S.w.Mc :-

RunWait('net user '& $Newuser & ' ' & $Newpass & ' /add /fullname:"' & $FName & '" /comment:"' & $comment & '"', '', @SW_HIDE)

How can this function be used with RunAs and/or RunAsWait?

From the help file:-

RunAs($sUserName, @ComputerName, $sPassword, 0, @ComSpec, @SystemDir)

What format does the parameter @ComSpec take so as to include the @SW_HIDE etc.?

I have tried a few combinations, but cannot get it to work

Thanks

Paul Fraser

Posted

In the help file for Autoit (3.2.12.0)...

RunAs ( "username", "domain", "password", logon_flags, "filename" [, "workingdir" [, flag[, standard_i/o_flag]]] )

Replace the filename with the following:

'net user '& $Newuser & ' ' & $Newpass & ' /add /fullname:"' & $FName & '" /comment:"' & $comment & '"'

Posted

In the help file for Autoit (3.2.12.0)...

RunAs ( "username", "domain", "password", logon_flags, "filename" [, "workingdir" [, flag[, standard_i/o_flag]]] )

Replace the filename with the following:

'net user '& $Newuser & ' ' & $Newpass & ' /add /fullname:"' & $FName & '" /comment:"' & $comment & '"'

Yes, but how do I include the @SW_HIDE param?

Paul

Posted

Yes, but how do I include the @SW_HIDE param?

Paul

By downloading the current version of AutoIt. The CURRENT parameters are:

RunAs ( "username", "domain", "password", logon_flag, "filename" [, "workingdir" [, show_flag [, opt_flag ]]] )

Or:

RunAsWait ( "username", "domain", "password", logon_flag, "filename" [, "workingdir" [, show_flag [, opt_flag ]]] )

;)
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Posted

By downloading the current version of AutoIt. The CURRENT parameters are:

Or:

;)

Thanks,

I don't think the help file has caught up yet !

RunAs ( "username", "domain", "password", logon_flags, "filename" [, "workingdir" [, flag[, standard_i/o_flag]]] )

Although I did miss the rather obvious reference to the flag info.

Paul

Posted

Thanks,

I don't think the help file has caught up yet !

RunAs ( "username", "domain", "password", logon_flags, "filename" [, "workingdir" [, flag[, standard_i/o_flag]]] )

Although I did miss the rather obvious reference to the flag info.

Paul

Also, the return I am getting from RunAsWait is 0 for success and not 0 for failure.

This is different to help file info.

Paul

Posted

Also, the return I am getting from RunAsWait is 0 for success and not 0 for failure.

This is different to help file info.

Paul

The return from RunWait() or RunAsWait() is the exit code of the CMD.exe shell environment, i.e. %ERRORLEVEL%, which is usually 0 for success. It also returns 0 for failure, so the thing to monitor is @error.

In contrast Run() and RunAs() return the PID of the spawned process, or 0 for failure.

;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Posted

The return from RunWait() or RunAsWait() is the exit code of the CMD.exe shell environment, i.e. %ERRORLEVEL%, which is usually 0 for success. It also returns 0 for failure, so the thing to monitor is @error.

In contrast Run() and RunAs() return the PID of the spawned process, or 0 for failure.

;)

Excellent information..where would I find this documented?

I think I have the latest version of the help file, (downloaded a few days ago) which contradicts this info.

Thanks

Paul

Posted

Excellent information..where would I find this documented?

I think I have the latest version of the help file, (downloaded a few days ago) which contradicts this info.

Thanks

Paul

I don't see the contradiction.

The 3.2.12.1 Prod help file under both Run() and RunAs() says:

Return Value

Success: The PID of the process that was launched.

Failure: Returns 0 and sets @error to non-zero.

And for RunWait() and RunAsWait():

Return Value

Success: Returns the exit code of the program that was run.

Failure: Returns 0 and sets @error to non-zero.

It's exactly the same for 3.2.13.7 Beta. What version did you download?

;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Posted

I don't see the contradiction.

The 3.2.12.1 Prod help file under both Run() and RunAs() says:

And for RunWait() and RunAsWait():

It's exactly the same for 3.2.13.7 Beta. What version did you download?

:D

Apologies ;)

Confusion between Run and RunWait help and misinterpretation of the exit condition

Thanks

Paul

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