Execute CMD command from code

后端 未结 10 1171
故里飘歌
故里飘歌 2020-11-30 06:38

In C# WPF: I want to execute a CMD command, how exactly can I execute a cmd command programmatically?

10条回答
  •  天命终不由人
    2020-11-30 07:19

    How about you creat a batch file with the command you want, and call it with Process.Start

    dir.bat content:

    dir
    

    then call:

    Process.Start("dir.bat");
    

    Will call the bat file and execute the dir

提交回复
热议问题