启动命令行包括C#参数 [英] Start a command line including arguments from C#

查看:166
本文介绍了启动命令行包括C#参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要开始像APP.EXE / ARG1:1 / ARG2:真正的一个完整的命令行。从我的C#应用​​程序

I need to start a complete command line like "app.exe /arg1:1 /arg2:true" from my C# app.

的Process.Start和的ProcessStartInfo需要有文件名和参数属性集。有没有一种方法来模拟一个真实的壳状执行(如之一,当您按下WIN + R)?

Process.Start and ProcessStartInfo needs to have the filename and arguments property set. Is there a way to mimic a true shell-like execute (like the one when you press WIN+R)?

推荐答案

是的,您可以启动的cmd.exe 与您要发送作为参数的全命令行。

Yes, you can launch cmd.exe with the full command-line you want to send as the arguments.

info.FileName = "cmd.exe";
info.Arguments = "app.exe /arg1:1 /arg2:true";

这篇关于启动命令行包括C#参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆