C#,cmd:使用C#在同一进程中插入两个不同的命令 [英] C# , cmd : insert two different command in same process using C#

查看:111
本文介绍了C#,cmd:使用C#在同一进程中插入两个不同的命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个命令,第一个是nslookup,第二个是ipconfig。我应该如何在一个进程中使用c#组合这两个命令?



我尝试了什么:



i have 2 command that is first "nslookup" and second is"ipconfig". How should i combine this two command in one process using c# ?.

What I have tried:

string text = "ipconfig";
string text2 = "nslookup";

string strCmdText;
strCmdText = "/k" + text;
System.Diagnostics.Process.Start("CMD.exe", strCmdText);

推荐答案

命令行将是cmd / k ipconfig&& nslookup。



因此,Process.Start调用的第一个参数是cmd,第二个参数是/ k ipconfig&& nslookup。
The command line would be "cmd /k ipconfig && nslookup".

So, the first parameter of the Process.Start call would be "cmd" and the second would be "/k ipconfig && nslookup".


这篇关于C#,cmd:使用C#在同一进程中插入两个不同的命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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