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.

link|improve this question

63% accept rate
You could try this suggestion and include the switches, but you may get a collision if you reuse a name lie 'dir' or something. unix.com/302235876-post4.html – skub Jan 16 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 at 14:44
@JdeBP - good point! – ldigas Jan 16 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 at 4:23
feedback

1 Answer

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.

link|improve this answer
"DIRCMD" ... that works for other commands as well, e.g. "COPYCMD" and alike? – ldigas Jan 16 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 at 16:09
Okey, two bad examples ... but I got the point. – ldigas Jan 16 at 16:15
@Idigas Unfortunately, there is no universal method. – aphoria Jan 17 at 14:03
feedback

Your Answer

 
or
required, but never shown

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