在程序中执行命令行命令的方法
2011-01-13 11:11
246 查看
在工作中需要在当前程序中执行命令行命令,在当前程序中执行其他程序的方法很多文章都有介绍,在他们的基础上简单的应用一下就可以实现。
1. 利用WinExec.
1. 利用WinExec.
ExecCommand(LPCSTR command) { char cmdstr[128]; // length is depend on implement sprintf(cmdstr, "cmd.exe /C %s", command); WinExec(cmdstr, SW_HIDE); } void main() { ExecCommand("echo hello"); }
相关文章推荐
- 让命令行程序执行完后不退出方法
- Java执行命令行下命令方法
- Java执行命令行下命令方法
- 利用命令行引用外部jar包以使程序正常执行的4种方法
- Windows下命令行里执行DIR命令,DIR程序在哪里存放。
- Go语言执行系统命令行命令的方法
- Mac系统终端命令行不执行命令 总出现command not found解决方法
- C#中一种执行命令行或DOS内部命令的方法
- 用Thinkphp写的简单程序在命令行执行(非 Thinkphp 下的cli模式 而是php下的命令模式)
- Mac系统终端命令行不执行命令 总出现command not found解决方法
- Mac系统终端命令行不执行命令 总出现command not found解决方法
- 在Linux中定时执行一个程序的方法之at命令
- 命令行进入android系统里执行linux命令的方法——busybox
- 使用管道重定向方法获取windows下命令行执行程序结果
- Mac系统终端命令行不执行命令 总出现command not found解决方法
- Linux C 程序执行 shell 命令并获取返回结果的方法
- eclipse编写程序命令行执行时提示找不到类时的解决方法
- Window下创建进程和执行命令行程序的方法
- C#中一种执行命令行或DOS内部命令的方法
- Mac系统终端命令行不执行命令 总出现command not found解决方法