解決長期搜索後發現的。 ..超過2周的搜索...我找到了正確的解決方案。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
ProcessStartInfo psi = new ProcessStartInfo("net", "help");
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;
psi.CreateNoWindow = false;
var proc = Process.Start(psi);
string s = proc.StandardOutput.ReadToEnd();
textBox1.Text = s;
}
private void button2_Click(object sender, EventArgs e)
{
ProcessStartInfo psi = new ProcessStartInfo("cmd");
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;
psi.CreateNoWindow = true;
psi.RedirectStandardInput = true;
var proc = Process.Start(psi);
proc.StandardInput.WriteLine(@"dir /w);
proc.StandardInput.WriteLine("exit");
string s = proc.StandardOutput.ReadToEnd();
textBox1.Text = s;
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
}
}
我希望這會幫助需要的人。
但我仍然有同樣的問題!帶/ s :(爲什麼?!? 我想做一個DIR/s的完蛋了。 請幫助
我最好的問候。
我試圖讓3個按鍵eatch一個電話就像一個命令顏色a –