program to run dos commands through a C program.

//Program to run dos commands through a C program.


#include <stdio.h>
#include <process.h>

int main()
{
	int choice=0;

	printf("\n***************************************\n");
	printf("1. Open Notepad...\n");
	printf("2. Get Ip Address...\n");
	printf("3. Shut down the computer...\n");

	printf("** Enter your choice :");
	scanf("%d",&choice);

	switch(choice)
    {
		case 1:
			system("notepad");
			break;
		case 2:
			system("ipconfig");
			system("pause");
			break;
		case 3:
			system("SHUTDOWN -S");
			system("pause");
			break;
		default:
			printf("\n Invalid choice !!!");
	}

	return 0;
}
    
***************************************
1. Open Notepad...
2. Get Ip Address...
3. Shut down the computer...
** Enter your choice :2

Windows IP Configuration


Ethernet adapter Local Area Connection 3:

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::38d0:910:14e:498b%17
   IPv4 Address. . . . . . . . . . . : 192.168.1.111
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.1.1

Wireless LAN adapter Wireless Network Connection 2:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Ethernet adapter Bluetooth Network Connection:
continue..