cancel
Showing results for 
Search instead for 
Did you mean: 

How to run cmd and get the result from CMD ?

ZelinShen
Level 3
I need to design a VBO, the step is  1, run a command , such as tesseract.exe --tessdata-dir .\tessdata  C:\Users\seiya\Desktop\random.jpg  - -l eng --psm 8   then it will return a string , refer to the attachment.   2, then I need to get the 'returning string'   can anyone help me ? thanks
2 REPLIES 2

John__Carter
Staff
Staff
Try pasting the contents of the attached file into an object.

AndreyKudinov
Level 10
My version: Process process = new Process(); process.StartInfo.FileName = ""cmd.exe""; process.StartInfo.Arguments = ""/c ""+cmd;  process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.RedirectStandardError = true; process.StartInfo.StandardOutputEncoding = Encoding.GetEncoding(866); // Codepage: 866 - Russian process.StartInfo.StandardErrorEncoding = Encoding.GetEncoding(866); // Codepage process.Start(); process.WaitForExit(); stdout = process.StandardOutput.ReadToEnd(); stderr = process.StandardError.ReadToEnd();