Tom*_*lis 4 .net c# process command-prompt
我有一个模块需要运行一个小的.Net命令行程序来检查更新.一切都很好,但是我无法抑制显示命令提示输出.
该应用程序拥有自己的Windows窗体,如果它检测到更新,它会弹出.更新需要作为单独的应用程序运行,因为它需要与启动它的DLL不同的执行上下文.
string path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\" + AUTO_UPDATE_EXENAME;
updater.StartInfo.FileName = path;
updater.StartInfo.Arguments = AUTO_UPDATE_PARAMETERS;
updater.StartInfo.CreateNoWindow = false;
updater.StartInfo.UseShellExecute = false;
updater.StartInfo.RedirectStandardOutput = true;
updater.StartInfo.WorkingDirectory = path;
updater.Start();
Run Code Online (Sandbox Code Playgroud)
我曾经最尝试了所有的不同工作组合CreateNoWindow,UseShellExecute和RedirectStandardOutput他们每个人在这恼人的黑盒子结果弹出.该应用程序写入stdout但我只使用它进行调试,用户不应该真正看到它生成的文本.
据说CreateNoWindow和/或RedirectStandardOutput应该防止弹出框,但无论我如何设置这些变量都是如此.
| 归档时间: |
|
| 查看次数: |
3516 次 |
| 最近记录: |