hamid_csharp
ارسالها: | 16 |
عضویت: | 4 /8 /1393 |
تشکر ها: | 6 |
تشکر شده: | 6 |
|
سوال : اجرای دستورات cmd در برنامه
کد ها رو به زیر تغییر بده بعد run as adminstrator بکن ببین درست میشه :
کد:
string pass=Environment.UserName; System.Diagnostics.ProcessStartInfo hyp = new System.Diagnostics.ProcessStartInfo("cmd");
hyp.RedirectStandardInput = true;
hyp.RedirectStandardOutput = true;
hyp.UseShellExecute = false;
System.Diagnostics.Process proc = System.Diagnostics.Process.Start(hyp);
proc.StandardInput.WriteLine(@"net user "+pass+" password");
proc.StandardInput.WriteLine(@"");
string output = proc.StandardOutput.ReadToEnd();
|
|
یکشنبه 18 آبان 1393 - 22:56 |
|