Answer the question
In order to leave comments, you need to log in
How to pass data from cmd.exe window?
From the program (Frame 3.5 winforms) I call the batch file and read the result of the execution, as well as the error, if it happens.
var processInfo = new ProcessStartInfo("cmd.exe", "/c " + "c:/app/remote.bat");
processInfo.RedirectStandardError = true;
processInfo.RedirectStandardOutput = true;
var process = Process.Start(processInfo);
string error = process.StandardError.ReadToEnd();
error
I send the
variable to the remote machine:File.AppendAllText("\\remoteserver\\app\error.txt" , "ОШИБКA: " + error + Environment.NewLine, Encoding.UTF8);
ERROR: "uppdate
"
Answer the question
In order to leave comments, you need to log in
You have utf8 in the sources, and in WinXP cp1251, for example, and in some places even cp866.
You need to specify the correct encoding.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question