更新时间:2023-10-21 11:12:22
好问题Mike.
这是您可以执行的操作:
Good question Mike.
This is how you can do this:
string inputPath = "\"\\\"C:\\some path\\filename.dat\\\"\"";
string outPutPath = "\"\\\"C:\\some path\\filename.out\\\"\"";
也许,只是注释:
1)您是否知道可以将控制台应用程序的输出重定向到任何流(不仅是文件,还可以是某些旨在读取和显示UI或类似结果的流)?请参见以下示例: http://msdn.microsoft.com/en-us/library/system.diagnostics.process.standardoutput.aspx [
Maybe, just side notes:
1) Do you know that you can re-direct output of the console application to any stream (not only the file, but, say, some stream designed to read and show results in UI or something like that)? See this sample: http://msdn.microsoft.com/en-us/library/system.diagnostics.process.standardoutput.aspx[^]. You can redirect bothstdout
andstderr
, seeSystem.Diagnostics.Process.StandardOutput
,System.Diagnostics.Process.StandardInput
, see alsoSystem.Diagnostics.Process.StandardInput
.
2) If you useProcess.WaitForExit()
(you may or may not need it), you should understand this is blocking call, so you need to do it all in a separate thread. This is easy enough.—SA