sqa Posted September 18, 2013 Share Posted September 18, 2013 Hi, I am redirecting Command Prompt logs into a text file, How can I know (programmatically) that this txt file has been released by DOS and I can use it? I tried by time modification, but it appeared that this time changes while DOS still writing in it. I can see that DOS complete its work from the DOS window, but how can I find it out programmatically? Thanks Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted September 19, 2013 Moderators Share Posted September 19, 2013 You can always use StdoutRead to capture the output and watch for it. Something like this should get you started: #include <Constants.au3> $cmd = Run(@ComSpec & " /c echo Testing>C:\File.txt", "C:\", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) While 1 $line = StdoutRead($cmd) If @error Then ExitLoop If $line <> "" Then MsgBox(0, "STDOUT read:", $line) Wend "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
sqa Posted September 19, 2013 Author Share Posted September 19, 2013 You are right, but my problem is I am executing several commands in DOS and each of them writes in the log. 1. execute DOS command1 > log.txt 2. analyze the log 3. execute DOS command2 > log.txt 4. analyze the log between step 1 and 2 I must be sure that the log is finalized and released by DOS, and only after that I can do step 2. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted September 19, 2013 Moderators Share Posted September 19, 2013 So look at the StdoutRead in a MsgBox, and see what line is shown in the DOS window when it completes after step 1. In your While statement, look for that line in StdoutRead. Also, are these DOS commands from some other application, or commands you are executing yourself? If it is the latter, why not cut out the middle man and do it all in AutoIt? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! 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