Wednesday, January 20, 2010

How to Open cmd using c program

#include<stdio.h>
#include<windows.h>

#include<shellapi.h>

int main()
{
int iReturn = (int) ShellExecute(NULL, "open", "ipconfig", "E:\\WORK\\ipconfigCommand", NULL, SW_SHOWNORMAL);
//> ipconfigoutput.txt
if (iReturn <= 32)
{
MessageBox (NULL,"Cannot open file. File may have been moved or deleted.", "Error!", 0) ;

}

return 0;
}

No comments:

Post a Comment