Answer the question
In order to leave comments, you need to log in
How to write the result of the program execution to a text editor at the end of it?
Good day!
Please tell me how to wait for the execution of the program and write all the data only after the end, if we run it in hidden mode?
The launch is:
start /BC:/check.exe --param 43 > C:/results/43.txt
Writes to the file as new data arrives.
If there would be a possibility of a certain timeout - it would not hurt.
There is no way to edit the source code of the program.
Answer the question
In order to leave comments, you need to log in
I don’t know why this is necessary, but if the text is not too large (otherwise it will ReadAll
choke and freeze), then you can do something like this
0</* : :
@ echo off
start /b CScript.exe //e:JScript //nologo //t:0 //i "%~fs0"
exit /b
*/ 0;
var WshShell = new ActiveXObject("WScript.Shell");
var text = WshShell.Exec("C:\\check.exe --param 43").StdOut.ReadAll();
WScript.Sleep(3000);
var FileSystemObject = new ActiveXObject("Scripting.FileSystemObject");
var TextFile = FileSystemObject.CreateTextFile("C:\\results\\43.txt", true);
TextFile.Write(text);
TextFile.Close();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question