Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Using the MS Windows Command Line

312 views

Published on

A lesson about the command line interface of MS Windows.

Published in: Internet
  • Login to see the comments

Using the MS Windows Command Line

  1. 1. Using the MS Windows command line The command line is very useful for running operating system commands that can be combined in sequence to produce sophisticated results. To demonstrate such capability students are required to run a series of commands that create a set of folders and subfolders. A simple text file is copied to several of the folders and renamed. Objectives The purpose of this exercise is to - understand the MS-DOS operating system on a typical PC - understand the relationship between PC hardware and the operating system - to develop the skill necessary to examine operating system configuration files - to understand simple batch file processing ***************************************************** Create a text file ***************************************************** IN A TEXT EDITOR, CREATE A TEXT FILE CALLED 'username'.txt but you MUST SUBSTITUTE your university login name for 'username' Write some text in the file along the lines of:- My name is:- .................Fred Bloggs My e-mail address is:- .............f.bloggs@hardwork.co Now you have created the file, make sure you save it.
  2. 2. ***************************************************** Creating a series of folders using simple MSDOS commands ***************************************************** Note: The following uses a subdirectory area on a hard disk. This can be your M: drive. - create a directory named 'A' on your hard disk drive. - save the file created above (username.txt) in the root of this directory called 'A'. Below is a diagram of the folder structure to be created A | +----USERNAME | +----FILES | | | +----WORK | | | +-----WORK.OLD | +----BIN | +----USER Now using commands types at the command line we will: - copy the file username.txt to EVERY directory AND subdirectory created - rename the file username.txt in the WORK.OLD directory to .old - delete the file username.txt from the 'A' directory
  3. 3. ***************************************************** Automate the above process using a 'batch' file ***************************************************** All the individual commands used to create the folder structure above can be placed in a text file in sequence. This file can then be executed at the command prompt, so creating the whole folder structure automatically. This is known as a 'batch' file. On MS systems this file has a file extension '.bat', eg setup.bat. Delete any directory structure which you may have created as above. Create a text file called :- setup.bat and store it in the root of drive M: Type into setup.bat the dos commands to create the directory structure, illustrated above. Make absolutely sure that all DOS commands always relate to the 'A' directory. You will then have a directory with two files in it, (username.bat and setup.bat) with NO directory structure called A. At the command prompt, make sure you are at the root of drive M: and then type at the prompt: setup.bat If you have done the job correctly, the batch file will run, creating the directory structure automatically, copying the username.txt files to the right places on the disk, renaming as required.

×