• [C#] 调用有管理员权限的CMD


    ProcessStartInfo startInfo = new ProcessStartInfo();
                    startInfo.FileName = "cmd.exe";
                    startInfo.Arguments = "/c C:\\Windows\\System32\\cmd.exe";
                    startInfo.RedirectStandardInput = true;
                    startInfo.RedirectStandardOutput = true;
                    startInfo.RedirectStandardError = true;
                    startInfo.UseShellExecute =false ;
                    startInfo.Verb = "RunAs";
                    Process process = new Process();
                    process.StartInfo = startInfo;
                    process.Start();
                    process.StandardInput.WriteLine("bcdedit");
                    process.StandardInput.WriteLine("exit");
                    string strRst = process.StandardOutput.ReadToEnd();
                    Bootinitext.AppendText("\n"+strRst );
                    process.WaitForExit();
    
  • 相关阅读:
    02-模板字符串
    01-学习vue前的准备工作
    21-z-index
    20-定位
    19-background
    18-超链接导航栏案例
    17-文本属性和字体属性
    16-margin的用法
    jBPM
    Table of Contents
  • 原文地址:https://www.cnblogs.com/SpeakHero/p/2439933.html
Copyright © 2020-2023  润新知