paulf39 Posted August 28, 2008 Share Posted August 28, 2008 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 Link to comment Share on other sites More sharing options...
DjDeep00 Posted August 28, 2008 Share Posted August 28, 2008 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 & '"' Link to comment Share on other sites More sharing options...
paulf39 Posted August 28, 2008 Author Share Posted August 28, 2008 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 Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 28, 2008 Share Posted August 28, 2008 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 Link to comment Share on other sites More sharing options...
paulf39 Posted August 28, 2008 Author Share Posted August 28, 2008 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 Link to comment Share on other sites More sharing options...
paulf39 Posted August 29, 2008 Author Share Posted August 29, 2008 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 Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 29, 2008 Share Posted August 29, 2008 Also, the return I am getting from RunAsWait is 0 for success and not 0 for failure.This is different to help file info.PaulThe 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 Link to comment Share on other sites More sharing options...
paulf39 Posted August 29, 2008 Author Share Posted August 29, 2008 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.ThanksPaul Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 29, 2008 Share Posted August 29, 2008 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.ThanksPaulI don't see the contradiction. The 3.2.12.1 Prod help file under both Run() and RunAs() says: Return ValueSuccess: The PID of the process that was launched. Failure: Returns 0 and sets @error to non-zero.And for RunWait() and RunAsWait(): Return ValueSuccess: 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 Link to comment Share on other sites More sharing options...
paulf39 Posted August 29, 2008 Author Share Posted August 29, 2008 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? Apologies Confusion between Run and RunWait help and misinterpretation of the exit conditionThanksPaul Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now