基本上,我希望命令提示符键入并执行命令" cd /"通过它自己。这是我用来打开命令提示符的代码:(Windows Form Application Visual c#)
private void button6_Click(object sender, EventArgs e)
{
Process cmd = new Process();
cmd.StartInfo.FileName = @"C:\Windows\system32\cmd.exe";
cmd.Start();
}
答案 0 :(得分:1)
使用StartInfo属性的Arguments属性传递/ K(保持窗口打开)和CD /(更改为root)
private void button6_Click(object sender, EventArgs e)
{
Process cmd = new Process();
cmd.StartInfo.FileName = @"cmd.exe";
cmd.StartInfo.Arguments = @"/K CD /";
cmd.Start();
}