0

Im trying to execute command based on this thread: Run Command Prompt Commands

Im using this code:

   private string cmdForDuplicate = @"C:\Windows\System32\DisplaySwitch.exe \clone";

    public Form1()
    {
        InitializeComponent();
    }

    private string cmdForExtend = @"C:\Windows\System32\DisplaySwitch.exe /extend";

    private void btn_extend_Click(object sender, EventArgs e)
    {
        var startinfo = new ProcessStartInfo();

        startinfo.UseShellExecute = true;
        startinfo.WorkingDirectory = @"C:\Windows\System32\DisplaySwitch";
        startinfo.FileName = @"C:\Windows\System32\cmd.exe";
        startinfo.Verb = "runas";
        startinfo.Arguments = "/c" + cmdForExtend;

        Process.Start(startinfo);
    }

What am I doing wrong?

0 Answers0