微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何通过调用在Windows下启动一个进程?

我有下面的代码在Linux下工作:

processstartinfo startInfo = new processstartinfo(); // Set in the process the executable and arguments startInfo.FileName = "ps"; startInfo.Arguments = "a"; Process proc = Process.Start(startInfo); proc.WaitForExit(); return proc.ExitCode;

但是,当我尝试使用Windows下的一个简单的命令进程:

processstartinfo startInfo = new processstartinfo(); // Set in the process the executable and arguments startInfo.FileName = "call"; startInfo.Arguments = "gpedit.msc"; Process proc = Process.Start(startInfo); proc.WaitForExit(); return proc.ExitCode;

它不工作(我知道在cmd.exe运行thins命令工作正常)。

我得到: Win32Exception was unhandled 。

检测应用程序外的拖动

如何find是否通过Powershell安装64位或32位的Excel?

从Windows窗体打印的工具

python 3在写入期间永久返回没有这样的文件或目录

如何在Windows中redirectPython中的C级别stream?

我也再次阅读本教程: 如何从C#开始一个进程?

我在Linux下使用了很多进程,但是我不能在Windows中看到我做错了什么。

在窗口操作系统中使用ctrl + alt + del禁用

用python启动一个独立的进程

C#:做while循环不工作作为supossed

什么是控件的“On_Load”等效表单?

为什么SendMessage()函数不起作用?

CALL是一个批处理命令,只能从命令行(poke)

我反而使用开始,它工作正常。

两个选项:

用GPEDIT参数调用MMC可执行文件

startInfo.FileName = "MMC.EXE"; startInfo.Arguments = "GPEDIT.MSC";

或者不带参数调用GPEDIT.MSC

startInfo.FileName = "GPEDIT.MSC";

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐