C# Form'da CMD komutlarını çalıştırmak

DarkLightning

Hectopat
Katılım
6 Eylül 2015
Mesajlar
273
Makaleler
2
Yer
Amasya
Daha fazla  
Cinsiyet
Erkek
Meslek
Kida Teknoloji - Yazılım Geliştirme
İyi günler arkadaşlar, programlamaya yeni başladım ve C# form'da elimdeki cmd komutlarını çalıştırmam lazım. CMD komutlarını buldum, fakat program çalışmadı. Kodlar aşağıda, yardımcı olabilirseniz çok sevinirim.

Mevcut CMD Komutları;
Kod:
"netsh wlan show drivers"
"netsh wlan set hostednetwork mode=allow ssid=wi-fi adı key=şifre"
"netsh wlan start hostednetwork"

Kod:
System.Diagnostics.Process process = new System.Diagnostics.Process();
            System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
            startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
            startInfo.FileName = "cmd.exe";
            startInfo.Arguments = "netsh wlan show drivers";
            startInfo.Arguments = "netsh wlan set hostednetwork mode=allow ssid=" + ssid.Text + "key=" + sifre.Text;
            startInfo.Arguments = "netsh wlan start hostednetwork";
            process.StartInfo = startInfo;
            process.Start();

Nerede hata yaptığımı söylerseniz teşekkür ederim.
 
Kod:
            System.Diagnostics.Process process = new System.Diagnostics.Process();
            process.StartInfo = new System.Diagnostics.ProcessStartInfo()
            {
                UseShellExecute = false,
                CreateNoWindow = true,
                WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden,
                FileName = "cmd.exe",
                Arguments = "/C komut",
                RedirectStandardError = true,
                RedirectStandardOutput = true
            };
            process.Start();
            string output = process.StandardOutput.ReadToEnd();
            MessageBox.Show("İşlem tamamlandı: \n"+output);
 
Bu siteyi kullanmak için çerezler gereklidir. Siteyi kullanmaya devam etmek için çerezleri kabul etmelisiniz. Daha Fazlasını Öğren.…