In C system of executes the cmd command to open and close programs

  • 2020-06-07 04:55:44
  • OfStack

Function prototype:


int system(char *command); 

To use this function you need to add < stdlib.h > The header file

1. Open the program

The system can use start command directly with its own program


system("start iexplore.exe"); // Start the ie 

Non - system native programs need to add paths


system("start D:\Tencent\WeChat\WeChat.exe"); // Start the client under the changed path  

Note that if there are Spaces in the path, you need to add double quotes to the entire path

2. Close the program


system("TASKKILL /F /IM iexplore.exe"); 

3. Check out help


>HELP 

>TASKKILL /? 

Related articles: