自己在家怎么做三明治:怎么在DELPHI程序中执行DOS命令

来源:百度文库 编辑:中科新闻网 时间:2024/04/28 18:34:46
怎么在DELPHI程序中执行DOS命令,我看过一个程序代码,能不能说详细点WINEXEC方法,我是新手
有人回答过WinExec('Command.com /C main.exe > tmp.txt',SW_Hide);
WinExec -- windows api function
Command.com /C string -- Carries out the command specified by string, and then stops.
main.exe > tmp.txt -- dos 命令行 你可以改称你想要的, 如 copy c:\a d:\
只要是命令行能行, 放到这也行
SW_Hide -- WinExec参数, 表示 运行时隐藏dos的那个黑框
,但我看不懂,谁能详细解说一下
这个知道了,但还是不懂,我要让它运行用户输入的DOS命令,WinExec(EDIT1.TEXT,SW_Hide);却提示错误,为什么呢

WinExec(EDIT1.TEXT,SW_Hide);必须是text启动已经注册的程序,才可以
deiphi具体里面怎么调用我不知道,但在C下,调用DOS命令的可以使用函数:system(char *command);如可以调用
system("dir");
system("copy c:\a.xx d:\");