Formatting may screw up: original:
Advanced fun with MS-DOS device names
-[El Half -]-

In MS-DOS, devices are represented as a file, thus they can also
be handled that way.
COM[1234] are the serial ports, AUX is the default serial port.
LPT[12] are the parallel printerports, PRN is the default one.
CON stands for 'Console', NUL can be compared to Unix' dev/null.

1.Printing a text without an editor

C:\>copy con prn
Hello world!
Aren't we elite?
This is a sentence
1 file(s) copied


Here we copy try to copy the input from the console to the default
parallel port. Because obviously normally no data is sent from the
keyboard you can type as you wish...You have to finish with a
CTRL+Z to declare the end of the "file".

2. File operations using device names

Creating/deleting a file:
C:\>copy con afile.txt
Hello world!
1 file(s) copied

C:\>copy nul afile.txt
Overwrite afile.txt (Yes/No/All)?y
0 file(s) copied


First, the keyboard's input is copied to a file named afile.txt
Second, nul is copied over afile.txt, this equals deleting the
file using the del command.

3. Elite coding(1)

You'll need a list of opcodes, and some assembly knowledge.

C:\>copy con

Now you can enter stuff using the ALT-key and the numeric keypad.
We're going to write the classic 'Hello world!' program.

Firt we'll have to move the value 0x09 to the ah register by using
this instruction: mov ah, 09h
The opcode for this is B409
You have to translate it to decimal first (using 2 chars of such a
hex string at a time). B4 == 180 in decimal and 09 is just 09.
Thus first type ALT+180 then ALT+09.

The complete example in hex is:
B409 BA09 01CD 21C3 2048 656C 6C6F 2077
6F72 6C64 2124 0D0A

What to type:
ALT-180 ALT-09 ALT-186 ALT-09 ALT-01 ALT-205 ! ALT-195 ALT 32 Hello world!$

Finish with a CTRL+Z.

Some stuff can't be entered this way. I first had assembled this (nasm)...

[BITS 16]
[ORG 0x0100]

[SECTION .text]

mov ah, 09h
mov dx, STUFF
int 21h
int 20h

[Section .data]
STUFF db "Hello$"

...and opened in a hex editor, but it contained some 0000, which is a
problem in this case, because nothing would be added if you typed
ALT+00. In this case what would happen is that dx points to the
wrong offset and only 'lo world!' is printed.

(1) The Hello world proggie that can be entered with the ALT-key comes
from 'Programming in extreme conditions' (slightly altered though).

4. Some other stuff

You can also send data to any other device:

C:\>echo hello > aux

or try to do things like:

C:\>copy aux prn

This tends to hang your computer.