Hi,
I seem to have completely forgotten how to execute a MS DOS command from a Windows app! Can you help?
I just want to execute the copy command!
Thanks,
Daniel
Printable View
Hi,
I seem to have completely forgotten how to execute a MS DOS command from a Windows app! Can you help?
I just want to execute the copy command!
Thanks,
Daniel
Use system function like
Hope it helps.Code:system("dir");
Thanks for your help. It was very obvious. I just had a mental block.
But is there a way to copy a file with out having the Console screen come up?
Daniel
ShellExecute( "c:\\MyProgram.exe", SW_HIDE);
For some powerful Win32 API file operation routines, try looking up SHFileOperation() in MSDN.
You can use the CopyFile() API function
There are several methods for launching another program from one program.
You can use _spawn(), _exec(), system(), WinExec(), ShellExecute(), ShellExecuteEx(), and CreateProcess().
The system() function is a more portable function.
WinExec(), ShellExecute(), ShellExecuteEx(), and CreateProcess() are unique to Windows programming. All four windows functions allow for launching an application in the background (window-hidden).
The WinExec() is the easiest of the four to use. It only takes two arguments, however MS recommends using the CreateProcess() instead of WinExec on all 32-bit programs.
See the following link for more details:
http://www.axter.com/faq/topic.asp?T...le=C%2FC%2B%2B
Thanks Bob,
The SHFileOperation() did the trick very nicely
Daniel