JSI Tip 0651 - Using the DIRCMD environment variable.

Jerold Schulman

August 13, 1998

1 Min Read
ITPro Today logo


The DIR command has many switches (type DIR /?):

 dir [drive:][path][filename] [; ...] [/p] [/w] [/d] [/a]attributes[/o]sortorder [/t]timefield [/s] [/b] [/l] [/n] [/x]

If you regulary type switches and have a favorite set that you use, you can cause the DIR command to remember them by setting the DIRCMD environment variable:

set DIRCMD=/b /o:-n

causes DIR to always use the /b and /o:-n switches. You can override these defaults for a given invocation of DIR:

DIR [drive:][path] /-b

will perform the above dir without the /b switch but will still use the /o:-n switch.

You should set the DIRCMD environment variable in Control Panel / System / Environment.


Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like