Some useful DOS commands

Useful DOS commands I’ve come across:

  1. Write to file
    [cmd] > [file]

    The result of the command on the left will be written to the file on the right. The file will be created if it doesn’t already exist, and overwritten if it does.

    Example:
    echo abc > c:\temp\myfile.txt

    Writes the text ‘abc’ to a new file called c:\temp\myfile.txt

  2. Append to file
    [cmd] >> [file]

    The result of the command on the left will be appended to the file on the right. If the file doesn’t exist it will be created.

    Example:
    echo abd >> c:\temp\myfile.txt

    Appends the the text ‘abc’ to the file c:\temp\myfile.txt