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..   
    









Was this page helpful? YES NO

Are you a blogger? Join our Blogging forum.



Comments and Discussions


We are using Google to publish ads on our website; Google has its own privacy policies. They may save log, cookies on your system. Google may also collect information of your system like IP address, region, city, country. For more details please go through the Google’s privacy policy.