Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
There are two ways to display the contents of a file through DOS. Both of these
methods employ the con (i.e., console, which consists of the keyboard and monito
r) device. Here we are displaying the contents of the file atari.exe, which is l
ocated within the c:\files\docs\ directory:
(using the copy command)
c:\> copy files\docs\atari.exe con
(using the type command)
c:\> type files\docs\atari.exe con
Create text files in DOS
While working in DOS, it is possible to create text documents easily, on the fly
, and without any external text editor. Here, we command DOS to record all keyst
rokes into a file called note.txt, which we will create in the c:\files\docs\ di
rectory:
(to create the text file and begin recording keystrokes)
c:\> copy con files\docs\note.txt
(to create a new line within the file)
press [ENTER]
(to stop recording keystrokes)
press [F6] or [CTRL+Z and then ENTER]
Add single lines of text to a file
To quickly append lines of text to any file, use the output redirection command
as follows:
c:\> echo sometext >> somefile.txt
This will append the text "sometext" to the file "somefile.txt". If the file exi
sts, the line of text will be added to the end of the file. If the file does not
exist, it will be created. To overwrite the contents of the file, use this inst
ead:
c:\> echo sometext > somefile.txt
Fun with the nul device
The nul device is like a black hole into which dumped data will simply disappear
. You can copy or pipe files or keystrokes into it and they will vanish forever.
Thus there are a few fun things that may be done with the nul device.
Here is a way to prevent inexperienced users from using your DOS machine while y
ou are away on break. The following method will create a situation in which a DO
S prompt exists, but fails to execute anything. The user will be able to type co
mmands, press enter, and scratch their heads while nothing happens and everythin
g they type is sent directly to the nul hole:
E = Bright Yellow
F = Bright White
Note: users may also change colors and other properties via the prompt shortcut
itself. Right-click the shortcut and select properties. Have a look around
lots
of choices!