Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

To illustrate on an example; instead of dir I want every time to show dir/od (sort by last modified).

How can I make dir behave like this without typing /od switch every time?

I know of doskey; is there any other way?

EDIT: I'm not looking for just dircmd, but a way for other commands as well ... rd /s for example.

share|improve this question
You could try this suggestion and include the switches, but you may get a collision if you reuse a name lie 'dir' or something. – skub Jan 16 '12 at 14:16
You should have chosen a different example, because now everyone is going to tell you about dircmd and forget that that was only one example. ☺ – JdeBP Jan 16 '12 at 14:44
@JdeBP - good point! – Rook Jan 16 '12 at 14:54
Sadly, there only seems to be variables for dir, copy, and move (dircmd and copycmd respectively). There is no forcmd despite—perhaps because of?—the complexity of the for command). – Synetech Feb 23 '12 at 4:23
up vote 2 down vote accepted

Create an environment variable called DIRCMD and set the value to the switches you want.

To test it, at a command prompt type SET DIRCMD=/OD. To make it permanent, setup the varible in the system properties.

share|improve this answer
"DIRCMD" ... that works for other commands as well, e.g. "COPYCMD" and alike? – Rook Jan 16 '12 at 14:39
COPYCMD will work too. Other commands you will have to test...from a CMD prompt type COMMANDNAME /? to see what your options are. – aphoria Jan 16 '12 at 16:09
Okey, two bad examples ... but I got the point. – Rook Jan 16 '12 at 16:15
@Idigas Unfortunately, there is no universal method. – aphoria Jan 17 '12 at 14:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.