hispeed_mike Posted August 13, 2007 Share Posted August 13, 2007 Hi, I have a script which runs sends a command to a command line and then moves on to the next command. What I want to do is to run it and get feedback on the completion if it encountered and error. So I looked up the @error. A quick outline of what I did is below.... Quic help to understand how the error value is set will help me get to where I am Going.... #include "Process.au3" Opt("RunErrorsFatal", 1) $netsh1 = RunWait (@ComSpec & " /c " & 'cacls "c:\Program Files\CB" /e /t /c /p "Inet":F', "", @SW_SHOW) If netsh1 = @error Then FileWriteLine (@DESKTOPDIR & "\SetupLog.txt", "Failed to set permissions on the xx folder - Set Permissions manually by turning off Simple File sharing and set permissions to Users with Full Access Privileges") EndIf The issue I am getting is the command runs successfully and it still writes the error to the log file. My logic is all wrong and needs straightening out.... Thanks for your help.... Mike Link to comment Share on other sites More sharing options...
narayanjr Posted August 13, 2007 Share Posted August 13, 2007 If @error Then FileWriteLine (@DESKTOPDIR & "\SetupLog.txt", "Failed to set permissions on the xx folder - Set Permissions manually by turning off Simple File sharing and set permissions to Users with Full Access Privileges") EndIf maybe not sure Link to comment Share on other sites More sharing options...
hispeed_mike Posted August 13, 2007 Author Share Posted August 13, 2007 If @error Then FileWriteLine (@DESKTOPDIR & "\SetupLog.txt", "Failed to set permissions on the xx folder - Set Permissions manually by turning off Simple File sharing and set permissions to Users with Full Access Privileges") EndIf maybe not sure I did try the removal of the @error = 1 but still got the same effect....Any other ideas Link to comment Share on other sites More sharing options...
narayanjr Posted August 13, 2007 Share Posted August 13, 2007 (edited) im just throwing ideas out not really sure if it will work or if it will do any thing at all Opt("RunErrorsFatal", 0) try that i guess it says in the help file that will set @error to 1 if it fails and instead of just If @error you could try If @error = 1 it really shouldnt effect it but its not gonna hurt Edited August 13, 2007 by narayanjr Link to comment Share on other sites More sharing options...
hispeed_mike Posted August 13, 2007 Author Share Posted August 13, 2007 im just throwing ideas out not really sure if it will work or if it will do any thing at allOpt("RunErrorsFatal", 0)try that i guessit says in the help file that will set @error to 1 if it failsand instead of just If @error you could try If @error = 1 it really shouldnt effect it but its not gonna hurtIt still writes an error if it completed successfully....Strange...This would mean that the @error always equals the commands outcome??????????I tried setting the RunErrorsFatal to 1 and 0, and also @error=1 or @error=0. Still no dice....do I just give it up as too hard...I really need to make sure I get a succes or failure ont he command....Also tried If $netsh1 = @error...still same result.Is there any other way?ThanksMike 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