C-sysytem命令的使用

#include <stdio.h>



void main()
{
	printf("hello world!!");
	getchar();
	
}

  

system命令

#include <stdlib.h>


void main() {
	//system("ipconfig");
	system("mspaint");
	system("pause");
}

  

ShellExecute

也可以用来打开程序启动

#include<stdio.h>
#include<Windows.h>


void main() {
	printf("核力量");
	MessageBox(0, "窗口内容:11111111", "窗口标题", 0);
	//第一个参数 设置0  是依赖的窗口编号    0表示是系统弹出来
	//第四个参数 是窗口的类型,设置为0 即可。

	//打开文件的操作
	/*ShellExecute(0, "open", "C:\Users\水杉科技\Desktop\test.txt", 0, 0, 1);
	ShellExecute(0, "open", "https://www.baidu.com", 0, 0, 1);
	ShellExecute(0, "open", "https://www.csdn.net", 0, 0, 1);*/
	//ShellExecute(0, "print", "C:\Users\水杉科技\Desktop\test.txt", 0, 0, 1);
	ShellExecute(0, "open", "notepad", 0, 0, 1);



	getchar();
}

  

原文地址:https://www.cnblogs.com/Mengchangxin/p/11630047.html