0923 "Operating System Tutorial" experiment one · The programming of DOS command interpreter

Source: Internet
Author: User
Tags clear screen

Programming of a DOS command interpreter

I. Purpose and REQUIREMENTS

1. Purpose of the experiment

(1) recognize DOS;

(2) master the Principle of command interpretation procedure;

(3) master the simple DOS call method;

(4) Master C Language programming preliminary.

2. Experimental requirements

Write a command-line interpreter similar to DOS,UNIX

(1) self-defined system prompt

(2) custom set of commands (8-10 )

(3) user input Help to find commands

(4) List the function of the command, distinguish internal or external commands

(5) user input quit quit

(6) internal commands are dir, CD, Md,rd, CLS, date, time, Ren, copy , etc.

Ii. contents of the experiment

According to the requirements, complete the design, coding, testing work.

Third, the experimental environment

1. pc microcomputer

2. Windows operating system

3. a /C + + program Development Integration Environment

Four, the experimental principle and the core algorithm reference program segment

#include<stdio.h>

#include<string.h>

void Main () {

  Char command[20];

  char s[20][20]={"dir", "CD", "MD", "RD", "CLS", "Date", "Time", "Ren", "Copy", "Help", "quit", "haha", "hehe", " Xixi "};

  int Count,key;

   while (strcmp (Command, "quit")!=0) {

    printf ("Please input command:\n");

    gets (command);

     for (count=0;count<20;count++) {

      if (strcmp (Command,s[count]) ==0) {

Key=count;

}

}

    Switch (key) {

       case 0:

        printf ("dir means no parameters: View files and folders in the current directory \ n");

        Break

       Case 1:

        printf ("CD directory name: Enter a specific directory. \ n ");

        Break

Case 2:

printf ("MD directory Name: Create a specific folder. dos under the habit called Directory,win under the habit called folder \ n ");

        Break

Case 3:

        printf ("Rd directory Name: delete a specific folder.") \ n ");

        Break

Case 4:

printf ("CLS directory Name: Indicates clear screen function \ n");

       Break

Case 5:

printf ("Data set Date command, function is set date \ n");

        Break

Case 6:

printf (" Time system Clock setting command, function: Set or display system period. \ n ");

        Break

Case 7:

printf ("Ren means the file is renamed, andtheren command is in the format: thefile name of theren source file name. \ n ");

        Break

Case 8:

printf ("Copy means copy command, copy information of his function \ n");

        Break

Case 9:

printf (" I'm not going to save you \ n");

        Break

Case 11:

printf (" haha \ n");

        Break

Case :

printf (" hehe \ n");

        Break

Case :

printf (" hehe \ n");

        Break

}

}

printf ("You ' ve quit the dos\n");

}


0923 "Operating System Tutorial" experiment one · The programming of DOS command interpreter

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.