提示:
用ShellExecute()
win98执行  c:\windows\command.com  /C  c:\test.exe
winNt、win2000:  c:\winnt\cmd.exe  /C  c:\test.exe
最好用环境变量读出  "comspec" 就知道命令解释器
没有 /c  就是返回你的界面;

解决方案 »

  1.   

    void __fastcall TForm1::Button1Click(TObject *Sender)
    {
        char buf[1024];
        GetEnvironmentVariable("Comspec",buf,sizeof(buf));
        String Cmd=String(buf)+"  /C  "+"dir";
        WinExec(Cmd.c_str(),SW_NORMAL);
    }
      

  2.   

    shellexecte()
    winexec()
    .........
      

  3.   

    shellexecte()
    winexec()
    .........
      

  4.   

    都是API调用,你自已改成DELPHI吧,
    之所以用  command  /C  dos命令
    是因为命令执行后要立即退出DOS窗口,
    否则这个DOS 进程不能自动中止