Dos Unleashed

Check Your Memory!
To check the available memory left on your machine, use the MEM command. There are several options available (depending on the version of Dos/Windows you are using) so type
at the DOS prompt to see what kind of memory checks you can perform.

Redirect the Positions of the Redirect

When you perform a command involving redirecting the output such as DIR *.TXT > TEXTLIST, you normally place the redirection symbol after the command you are redirecting. You don't have to do this. The command > TEXTLIST DIR *.TXT works fine.

Forcing the Directory to Display a Certain Way

If you wish to set the directory listings a certain way (when you use the DIR command), set the DIRCMD environmental variable to the parameters you wish to use.
To see a list of possible parameters for the DIRCMD, see the list of possible parameters for the DIR command. Type
DIR /?
To set the DIRCMD environmental variable, add the line


in your AUTOEXEC.BAT file, replacing 'xxx' with the parameters you wish to use. For example, the parameter "/ON" would cause your DIR results to be automatically sorted by filename. The "/W" command automatically sets the DIR results to a wide-directory format.

Display ErrorLevel on the screen
SUMMARY: Debug batch files by displaying the error level returned by DOS commands.

Debugging batch files and need to see the error level results of every DOS command echoed to the screen? Try this command:


This echoes the command processor with 'errorlevel' echoed to the screen.

Quickly Get COM and LPT Port Status

To get the retry and redirection status of your COM and LPT ports, enter the following command:


Display a Directory Tree of all Subdirectories and Files

Ever need to output a list of all the directories and subdirectories on a particular hard drive or removable media? The tree command does just that, and you can pipe the results to a text file for further manipulation or printing.

To view all of the directories and subdirectories on a device, just cd\ to the root of your drive and then execute the tree command. Else, only the subdirectories of the current directory will be displayed.

The following parameters modify the output:

This outputs all files contained in the current directory and subdirectories. Issuing this command from the root directory can show all non-hidden files on the current drive, so the output may be long!
By default, the treecommand uses simple graphics to signify subdirectories. If you are having trouble processing or printing the results, add this parameter to display ASCII characters.
The following example command, executed from the root directory of a hard drive or removable media, creates a text file tree.txt containing all non-hidden files and folders. This may take a while to process, so be patient!

tree /f > tree.txt

Display Directory and File Owners
If you administer a Windows XP machine containing multiple user accounts, it may prove beneficial to view who owns a particular file or directory. This can help prevent accidentally moving or deleting a file used by someone else, or this feature can help monitor unwanted activity.
dir /q
If you just want to find files owned by the Administrator account, for example, use the following piped command:
dir /q | find "Administrator"
To view all files owned by Administrator in the current directory and all subdirectories, pipe the command with findstr as follows:
dir /q /s | findstr "Administrator Directory"
This will display each directory name followed by all files (if any) owned by the Administrator account.

Change Title of a DOS Prompt Window

To help simplify matters, you can change the window title of an individual DOS prompt with the title command. Entering title and then the name of a desired title will change the prompt's title bar, also changing its description on the Windows taskbar.

For example, if you want to open a DOS prompt with the title Web Server Log, one way to do so is the following:

1. Click "Start" - "Run".
2. Enter cmd /k title Web Server Log and press ENTER.

posted under |


Newer Post Older Post Home

We have seen by



Recent Comments