Programming Road (1), writing program Open Notepad, calculator, etc.

Source: Internet
Author: User



First, the command line startup program











To close a program from the command line:taskkill/f/im program name. exe






Second, open Notepad, calculator


 
1 #include <stdlib.h>
2 
3 void main(){
4 system("notepad");//Open Notepad
5 system("pause");
6
7 system("calc");//Open the calculator
8 system("pause");
9 }
Third, parallel open program
1 #include<stdlib.h>
  2 
  3 void run1(){
  4 system("notepad");
  5 system("calc");
  6 system("mspaint");
  7 }
  8 
  9 void run2(){
10 system("start notepad");
11 system("start calc");
12 system("start mspaint");
13 }
14
15 void main(){
16 run1();//In turn
17 run2 (); / / added start is parallel
18 } 
Four, Notepad programming (disguised as a master, ^_^)


1, first write a program with Notepad






2. Run vs Developer Command prompt






3. Switch the drive letter to the code file path, compile the link with "CL", Generate "1.obj" and "1.exe" files





Five, switch machine spoof, open file, open directory, etc.
1 #include<stdlib.h>
2 void main(){
3 system("Shutdown -s -t 60");//Shutdown after 60 seconds
4 system("pause");
5 system("Shutdown -a");//Cancel the shutdown
6 } 
1 #include<stdlib.h>
  2 void main1(){
  3 system ("explorer.exe F: \\ Baidu cloud download \ "MATLAB image processing examples detailed"); / / file manager Open any directory, pay attention to the double slash
  4 system("pause");
  5 }
  6 //Open the complex directory \\->\ \"->"
  7 void main2(){
  8 system("\"C:\\Program Files\\Internet Explorer\\iexplore.exe\"");//Open the IE browser
  9 system("pause");
10 }
11 //Open the file (can be a document, video, picture)
12 void main3(){
13 system("E:\\1.jpg");
14 }
15
16 void main4(){
17 system("D:\\360\\360se6\\Application\\360se.exe www.qq.com");//360 browser opens the specified website
18 }
19
20 void main(){
21 system("start calc");
22 system("pause");
23 system("taskkill /f /im calc.exe");
twenty four } 





Programming Road (1), writing program Open Notepad, calculator, etc.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.