How to run cmd and get the result from CMD ?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
08-11-18 09:34 AM
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
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
08-11-18 05:03 PM
Try pasting the contents of the attached file into an object.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
09-11-18 12:49 PM
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();
