User's Guide
  explosive tnt
  teckies tutor
  teckies files
  helpzone a4q
  computer health

  net@lebanon online magazine

teckies.tutor / DOS

Basic Guide to DOS Basic Guide to DOS
      Playing with DOS commands

Commands usage

Most DOS commands have switches or options that extend their capabilities. For instance using /P with DEL will ask you to confirm before deleting any file, this prevents you from accidently deleting
files on your system.
In this section we will take a look at both Internal and External commands and see how to control their output.
Commands are grouped according to their nature (shell, external).

Shell/Internal commands usage


DIR [FullFilePath] [DisplayFormat] [Attributes] [SortOrder]

[FullFilePath]: Specifies the path to the file e.g c:\windows\tips.txt
[DisplayFormat]:Controls the display format.

/P will list information by pages and pauses after each screen.
/W will display information horizontally on the screen width.
/S lists files in specified directory and all subdirectories.
/B lists full filenames without format, no header & summary info.
/L uses lowercase in listing files.
/V displays full information such as space allocated, attribute,
date accessed & modified
/4 uses 4 digits to display year (ignored if /V is used).

[Attributes]: Acts like a filter, so you can display only archive, hidden,
ready-only or system files. Use /A: or /A first to specify an attribute.

D Directories
R Read-only files
H Hidden files
A Files ready for archiving
S System files
- Prefix meaning not

[SortOrder]: Sorts files for better analysis, use /O: or /O to specify
a sorting order.

N In alphabetical order (numbers first)
S By size (smallest first)
E By extension (alphabetic)
D By date & time (earliest first)
G Displays directory first
- Reverses order of listing.
A By Last Access Date (earliest first)

PS: Use the prefix "-" to reverse the order of listing, for instance
typing /o-n will list files from Z to A

DIR C:\myfolder /a:r /o:-n /p

The command will list files located inside "myfolder" at root directory
(C:\) that have a read-only attribute (/a:r) by reverse alphabetical
order (/o:-n) and by page. (if the listing exceeds the screen height).

CHDIR or CD [drive:][path][..] [...] [\]
[drive] Type CD drive: to display the current directory in the specified drive. Type CD without parameters to display the current drive and directory.

[path] The full path to the file.

[..] Specifies that you want to change to the parent directory.

[...] Moves 3 directories up, only available from MS-DOS Prompt,
use a dots per directory.
[\] Sends you to root directory no matter where you are.

CD.... (while at C:\Windows\Help\Images)

The command will move you to the root directory.
Remember that this command works only at MS-DOS Prompt and
not with the actual DOS (in case you've restarted in DOS mode)

DEL or ERASE [drive:][path]filename [/P]

[drive] Specifies the drive where the file are located.

[path] The full path to the file(s) to delete.
Use wildcards (*) to delete specific file types.

[/P] Prompts for confirmation before deletion.

[.] Deletes of all files in the current directory.

DEL *.txt /P

This will delete all files with .txt extension (text files)
in the current directory.

DEL . 
Be careful with this command, it will delete every file
in the current directory.

NOTE: You'd better use /P when deleting files.

COPY [/A or /B] source [/A | /B] [+] 
     destination [/V] [/Y or /-Y]
[/A | /B] specifies whether you're copying an ASCII (text) file
or BINARY file.

[+] Use the (+) to copy multiple files in one destination file.

[/V] Double-checks the files being copied, verifying their integrity.

[/Y or /-Y] Use /-Y to get a warning when you're overwriting a file,
/Y suppresses the overwriting confirmation.

COPY /A file1.txt+file2.txt C:\folder\final.txt /V /-Y

The command above copies the content of file1.txt and file2.txt
in ASCII mode since both are text file to the destination
c:\folder\final.txt verifying the integrity of the files (/V) and warns
in case a file called final.txt already exists in that location.

TYPE [drive:][path]filename [|more] [> file]
[drive:] specifies the drive from where you're copying an ASCII (text) or BINARY file.

[path] full path to the file.

[|more] Although TYPE doesn't have any switches, this syntax allows the screen to Pause after each display instead of listing the full content of a file. This is quite useful when you have a lengthy file.

[> file] Redirects the output to a text file, nothing appears on the screen, data is saved to the specified text file.

TYPE onebigfile | more

This will display the content of "onebigfile" and pauses after each screen full of data.

More information will be available soon...

Press CTRL-P to print the page   <<<Back

Choose a Tutorial

What do you need ?

Basic Guide to DOS