Jump to content

Need help with Windows cmd


Buba235
 Share

Recommended Posts

Hi folks!

I have some problems with reading from console window under Windows. First of all I will show you my problem. I will start an application that uses the Windows console and do some work with this application. Now it could happen that there are some errors thrown of the application. This errors would not cause the application to terminate, but the error will be written to the console. And that is my problem. How can I read this error strings and write them into a file?

My code:

; includes
#include <file.au3>
#include <Date.au3>


; Set path of the binaries
$SDK_Binary_Path = _PathFull(@ScriptDir & "..\..\sdk\bin")
; Set the path to the logfile
$Startup_log_Path = _PathFull(@ScriptDir & "..\..\result")

; Open a new file to save the results of this test
$error_log = FileOpen($Startup_log_Path & "\startup_zip_result.log", 1)
If $error_log = -1 Then
    Exit (1)
EndIf
FileWrite($error_log, "#################### Begin of startup test ####################" & @CRLF)

; call the example server and check if the server started up
$PID_exampleServer = Run($SDK_Binary_Path & "\example_server.exe")
If $PID_exampleServer = 0 Then
    FileWrite($error_log, "" & _NowDate() & "-" & _NowTime() & "##### ERROR - Failed to startup the example server !!!" & @CRLF)
    Exit (2)
Else
    ; Just wait some time to give the server the chance to start up correctly
    Sleep(2000)
    FileWrite($error_log, "" & _NowDate() & "-" & _NowTime() & " SUCCESS - Startup of example server was successful " & @CRLF)
EndIf

This code will start a new console and will output some text. This text I will write into a file. Is it possible to do this? Please could you help me?

Thanks for every help

Buba

Link to comment
Share on other sites

whatever Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

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...