Answer» Well, I have made a .bat file that gives you options.
The problem is that I cant figure out how to save everything the program writes to a txt. I already have it SAVING the time and renaming the file and such, as far as ive understood it should be after the .exe in the CODE.
Code: [Select]ECHO @prompt set date=$d$_set time=$t$h$h$h > {a}.bat %comspec% /e:2048 /c {a}.bat > {b}.bat FOR %%v in ({b}.bat del) do call %%v {?}.bat ECHO %date% %time% >> logonserverlog.txt ECHO Logging logonserver START /B /WAIT logonserver.exe ECHO @prompt set date=$d$_set time=$t$h$h$h > {a}.bat %comspec% /e:2048 /c {a}.bat > {b}.bat FOR %%v in ({b}.bat del) do call %%v {?}.bat ECHO %date% %time% >> logonserverlog.txt FOR /F "tokens=1-5 delims=:" %%d in ("%time%") DO rename "logonserverlog.txt" %%d-%%e.txt GOTO START This is part of the code. What this is going to do (you probably understand just by looking) is make a file called logonserverlog.txt, save the date, and time and then whenever it shuts down or crashes (most likely crashes) then it will save the time there as well. It also renames the file to the time it stopped.
I also have an option of MAKING it LOOP the start, so it automatically starts when it crashes. Guessing that the command for exporting the text to the .txt has to be after the START. Every comment is welcome.Wow! I haven't seen a date/time extraction routine like yours since DOS days. But hey, if it worked then, it should work now.
Have you tried simply redirecting the output of logonserver.exe to your log file?
Code: [Select]START /B /WAIT logonserver.exe >> logonserverlog.txt
If you don't need all the output in your log file, you might be able to split out the STDOUT and the STDERROR data streams.
Just a thought. using Code: [Select]START /B /WAIT logonserver.exe >>logonserverlog.txt was the first thing I tried. However that caused everything to stop and not work.
However, after some messing around I managed to get it working.
Code: [Select]START /B /WAIT logonserver.exe>logonserverlog.txt that almost made me cry thinking of all the time spent figuring that out. But thanks alot for your response ^_^ might pick up php or autoit again
|