#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define N 30
Main ()
{
Char Str[n];
int i,j;
Char Cmd[n][n] = {"dir", "CD", "MD", "RD", "CLS", "Date", "Time", "Ren", "Copy", "Quit", "help"};
printf ("Microsoft Windows XP [version 5.1.2600]\n");
printf ("<C> Copyright 1985-2001 Microsoft crop.\n");
while (1)
{
printf ("\nc:\\documents and settings\administrator>");
Gets (str);
STRLWR (str);
for (i=0;i<20;i++)
{
{
if (strcmp (str,cmd[0]) ==0)
{
printf ("dir internal command input correct \ n");
printf ("The purpose of this command is to display files and subdirectories in a directory. \ n ");
Break
}
else if (strcmp (str,cmd[1]) ==0)
{
printf ("CD internal command input is correct \ n");
printf (the function of this command is to display the name of the current directory or change it.) \ n ");
Break
}
else if (strcmp (str,cmd[2]) ==0)
{
printf ("MD internal command input correct \ n");
printf ("The purpose of this command is: to create a directory. \ n ");
Break
}
else if (strcmp (str,cmd[3]) ==0)
{
printf ("Rd internal command input is correct \ n");
printf ("The purpose of this command is: to delete a directory. \ n ");
Break
}
else if (strcmp (str,cmd[4]) ==0)
{
printf ("CLS internal command input is correct \ n");
printf ("The purpose of this command is to clear the screen. \ n ");
System ("CLS");
Break
}
else if (strcmp (str,cmd[5]) ==0)
{
printf ("Data internal command input is correct \ n");
printf (the function of this command is to display or set the date. \ n ");
Break
}
else if (strcmp (str,cmd[6]) ==0)
{
printf ("Time internal command input is correct \ n");
printf ("The command does this: the internal command displays or sets the system time.") \ n ");
Break
}
else if (strcmp (str,cmd[7]) ==0)
{
printf ("ren internal command input is correct \ n");
printf ("The purpose of this command is to rename the file. \ n ");
Break
}
else if (strcmp (str,cmd[8]) ==0)
{
printf ("Copy internal command input is correct \ n");
printf ("The purpose of this command is to copy at least one file to another location.") \ n ");
Break
}
else if (strcmp (str,cmd[9]) ==0)
{
Exit (0);
}
else if (strcmp (str,cmd[10]) ==0)
{
printf ("Help external command input correct \ n");
printf ("For more information about a command, type the help command name \ n");
printf (the "dir internal command displays files and subdirectories in a directory. \ n ");
printf (the CD internal command displays the name of the current directory or changes it. \ n ");
printf ("MD internal command creates a directory.") \ n ");
printf ("Rd Internal command Delete directory: \ n");
printf ("CLS internal command clears the screen.") \ n ");
printf (the date internal command displays or sets the dates. \ n ");
printf ("Time Internal command internal command displays or sets the system times.") \ n ");
printf ("Ren internal command renames the file. \ n ");
printf (The Copy internal command copies at least one file to another location. \ n ");
printf (the "Help external command" provides information about Windows commands.) \ n ");
printf ("Quit external command quits command interpreter \ n");
printf ("\ n For more information about tools, see the command-line reference in the online Help. \ n ");
Break
}
else if (strcmp (Str,cmd[i])!=0)
{
printf ("This command is not an internal or external command, it is not a running program or a batch file \ n");
printf ("\ n");
Break
}
}
}
}
}
Experiment one command interpreter program CMD writing