a problem on WinExec
-
I can use this command line "exefilename.exe -? >>a.txt" in Windows command prompt to store the parameter information into a.txt. But when I use WinExec to execute this command in my program, it doesn't work. neither does ShellExecute. The only thing it does is displaying the parameter info in the command prompt terminal (I can see the prompt flashing). Thank you to help me!
-
I can use this command line "exefilename.exe -? >>a.txt" in Windows command prompt to store the parameter information into a.txt. But when I use WinExec to execute this command in my program, it doesn't work. neither does ShellExecute. The only thing it does is displaying the parameter info in the command prompt terminal (I can see the prompt flashing). Thank you to help me!
Well, the program itself isn't the one doing the redirecting, it's the "cmd" (NT bases systems) or "command" (95 bases boxes) program that does the redirecting. So, if you want to do it, you can do it like this:
// NOTE: not very safe code. Also, it will only work on NT/2K/XP (since I used cmd.exe).
TCHAR a_szCommandLine[512] = {0};
_stprintf( a_szCommandLine, _T("cmd.exe /c \"exefilename.exe -? > a.txt\"") );
WinExec( a_szCommandLine, SW_HIDE );Chris Richardson
Terrain Software -
Well, the program itself isn't the one doing the redirecting, it's the "cmd" (NT bases systems) or "command" (95 bases boxes) program that does the redirecting. So, if you want to do it, you can do it like this:
// NOTE: not very safe code. Also, it will only work on NT/2K/XP (since I used cmd.exe).
TCHAR a_szCommandLine[512] = {0};
_stprintf( a_szCommandLine, _T("cmd.exe /c \"exefilename.exe -? > a.txt\"") );
WinExec( a_szCommandLine, SW_HIDE );Chris Richardson
Terrain Software