CircuitB0mB's Dive into MS-DOS - Old and New - Prt 2.a

Stuff that don´t fit in the other categories.
Post Reply
User avatar
CommonStray
Forum Assassin
Forum Assassin
Posts: 1214
Joined: 20 Aug 2005, 16:00
15

CircuitB0mB's Dive into MS-DOS - Old and New - Prt 2.a

Post by CommonStray »

Ok everyone here is the awaited second part of the MS-DOS Dive!

Contents:

1.Command Syntax
2.The Command Line
a - command name
b - Parameters
c - switches
3.Making a DOS menu using a Batch file
4.Changing System Environment Variables
5.Running Programs from prompt

Overview:

DOS is a command line interface, you have to know the commands it accepts to take advantage of its features. It also allows Batch Scripting.

"Welcome to MS-DOS, the most widely used operating system for personal computers." - MS-DOS Operating System Users Guide and Reference. Version 5.0. Published 1987-1991

1. Command Syntax

Definition - Command Syntax is the order that you have to type the command along with any parameters or switches that follow it.

Elements in bold must be typed exactly as they are in the syntax line, and other elements are in italics

Example: sample {+r|-r}{drive:}{path} filename {...}{options}

Where sample = the command

{} = optional, do not type these in when at prompt!

| = this pipeline separates mutually exclusive choices in a syntax line, does not need to be typed

drive: = specifies either hard disk or floppy

path = the route the os follows through directory structure

filename = specified file

... = that the previous parameter or switch can be repeated several times, type only the info not the dots(ellipsis)

options = specifies optional command parameters or switches

I will show you the correct syntax for a few common commands.

Del (Delete)

2 types
Syntax = del{drive:}{path}filename{/p}
Syntax = erase{drive:}{path}filename{/p}

DIR

Syntax =
dir{drive:}{path}{filename}{/p}{/w}{/a:attributes}{/o:sortorder}{/s}{/b}{/l}

Format

Syntax = 4 types
format drive:{/v{:label}}{/q}{/u}{/f:size}{/b|/s}
format drive:{/v{:label}}{/q}{/u}{/t:tracks/n:sectors}{/b|/s}
format drive:{/v{:label}}{/q}{/u}{/1}{/4}{/b|/s}
format drive:{/q}{/u}{/1}{/4}{/8}{/b|/s}

And thats Syntax...easy, its just the way the command is written out with all the switches and parameters and crap!

2.The Command Line

Now I know I should have brought this part up in the first tutorial, so im going to go about and explain this stuff here, so you know ;)

a. Command Name

The Command Name is is what you type first. It tells the action you want to perform. Some commands such as CLS (CLear Screen) consist of just the name, other need more than that.

b. Parameters

Parameters define the object you want DOS to perform on. Some require only one parameter, other require more. Parameters are everything from drive names to filenames and even switches, paths etc...

c. Switches

A forward slash followed by a single letter or number is a switch. If a command has more than one, you type them one after the other. Switches modify the way a command perfroms its task.

Here are examples of commands and their switches.

Del(Delete)

Switches: /p = prompts you for confirmation

DIR

Switches:

/p = display one screen at a time
/w = display in wide format
/a:attributes = displays only the names of directories and files with the attributes specified
---------------------------------------------------------------
attributes are
h = hidden files
-h files arnt hidden
s = system files
-s files other than system files
d = directories
-d only files
a = files ready for archiving
-a files that have not changed since last archiving
r = read-only files
-r files that arnt read-only
----------------------------------------------
switches cont.

/o:sortorder
controls order that dir sorts and displays names and filenames.
----------------------------------------------
n = alphebetical order
-n revers alphabetical order
e = alphabetical by extension
-e reverse alphabetical extension
d = by date and time, earliest first
-d date and time, latest first
s = by size, smallest first
-s by size, largest first
g = directories before files
-g directories after files
----------------------------------------------
switches cont.

/s = listes every occurance in a specified directory and subdirectories, of the filename

/b = lists each directory or filename, one per line with extension, overrides /w switch

/l = unsorted directory names and filenames in lowercase

Format

Switches:

/v:label = specifies volumn label

/q = deletes teh file allocation table (FAT/FAT32) and root directory or previously formatted disk

/u = specifies an unconditional format operation for a floppy or hard disk. It destroys all data on a disk and prevents later unformatting

/f:size = specifies the size of the floppy disk to format

/b = reserves space for the system files IO.sys and msdos.sys on newly formatted disk

/s = copies operating system files IO.sys, msdos.sys, and command.com to newly formatted disk

/t:tracks = specifies the number of tracks on the disk, if you use /t you must use /n, so use /f instead...

/n:sectors = number of sectors per track on the disk

/1 = formats a single side floppy

/4 = formats a 5.25, 360K double sided double density floppy ... oooooo

/8 = formats 5.25 with 8 sectors per track 8O

Well thats it for part 2.a be back shortly for part2.b!!!

User avatar
Nerdz
The Architect
The Architect
Posts: 1127
Joined: 15 Jun 2005, 16:00
16
Location: #db_error in: select usr.location from sucko_member where usr.id=63;
Contact:

Post by Nerdz »

Nice! now work on the next one! :P
Give a man a fish, you feed him for one day.
Learn a man to fish, you feed him for life.

Post Reply