想执行个DOS命令,象"dir>d:\test.txt"这样的
不想用system()因为会弹出一个DOS窗口
有什么方法可以执行DOS命令却不弹窗口的函数吗
谢谢

解决方案 »

  1.   

    ShellExecute(),最后一个参数 SW_HIDE
      

  2.   

    HINSTANCE ShellExecute(
        HWND hwnd, 
        LPCTSTR lpOperation,
        LPCTSTR lpFile, 
        LPCTSTR lpParameters, 
        LPCTSTR lpDirectory,
        INT nShowCmd
    );
      

  3.   

    ShellExecute()和WinExec()我都用过
    带参数的DOS命令好象没反应
      

  4.   

    WinExec("Cmd.exe /C dir>d:\\test.txt", SW_HIDE);    //这里要换成双斜杠
    ShellExecute(NULL,"open","c:\\WINDOWS\\system32\\cmd.exe","/c dir>d:\\test.txt","",SW_SHOW);        //同上
      

  5.   

    ok搞定了:)
    谢谢Snow_Ice11111(雪上加冰)