Run Command Prompt Commands

前端 未结 14 1955
暖寄归人
暖寄归人 2020-11-21 05:32

Is there any way to run command prompt commands from within a C# application? If so how would I do the following:

copy /b Image1.jpg + Archive.rar Image2.jp         


        
14条回答
  •  醉梦人生
    2020-11-21 06:05

    if you want to keep the cmd window open or want to use it in winform/wpf then use it like this

        string strCmdText;
    //For Testing
        strCmdText= "/K ipconfig";
    
     System.Diagnostics.Process.Start("CMD.exe",strCmdText);
    

    /K

    Will keep the cmd window open

提交回复
热议问题