Apr 8, 2008 at 9:42pm
Hi all,
I've written a C++ code to call cmd.exe from within this code as shown below:
ShellExecute( NULL, "open", "C:\\WINDOWS\\system32\\cmd.exe",
"ipconfig", "C:\\", SW_SHOWNORMAL);
It calls the cmd.exe and the command window comes up on the screen,but it does not pass the "ipconfig" to it so no action is executed.
Does anyone know how to pass the "ipconfig" to the command window and execute it (so current IP configuration appears in the cmd window)?
Any help will be appreciated.
Thanx.
Mux.
Apr 10, 2008 at 9:24am
Hi, i would suggest using system instead of shellExecute
but you can open in command promt "ipconfig" using shellExecute
1 2 3 4 5 6 7 8
|
ShellExecute(
NULL,
_T("open"),
_T("cmd"),
_T(" /C ipconfig"), // params
_T(" C:\ "),
SW_SHOW);
|
Last edited on Apr 10, 2008 at 9:25am