Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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

The dir command checks for a dircmd environment variable for default arugments to use. Likewise, the copy and move commands check copycmd. Is there a corresponding variable (by any name) for the for command or another way to specify default arguments for the for command?

Whenever I use the for command to parse a file (using the /f switch), I always (so far) use the "delims=" argument. This is annoying to type (especially when I forget it).

Is there a way to set default arguments for the for command? (I tested using a forcmd variable, but it did not work. If so, does it work in DOS as well as the Windows command-prompt?

share|improve this question
Argh! I’m using for’s /f switch a lot more these days to accommodate its inability to see hidden objects. I almost always have to specify the delims= option to allow it to work with filenames with spaces, so it is aggravating that there is no way to have it always be specified.◔_◔ – Synetech May 18 '13 at 22:08


The Windows command prompt's for built-in doesn't support anything called "FORCMD". No environment variable will change its behavior. There is no way to specify its defaults.

cmd.exe is an enhancement of the true DOS's - it supported "Command Extensions" which extended and modified the behavior of many commands, including all the extra stuff on for.

cmd.exe is a Win32 executable and will not work under true 16-bit native DOS., which will, does not support the cmd.exe extensions - and the same applies as the cmd.exe's for: no environment variable changes its behavior and there is no way to specify its defaults (not that it would be useful as the for is much more limited)

Still available via 32-bit versions of Windows, at least up to XP, is the old macro utility doskey that was included starting at MS-DOS version 5 or 6 and kept at least til XP. Defining some macros may help you avoid a bit of extra typing.

share|improve this answer
I am familiar with everything you said. None of that was an answer to the question I asked. – Synetech Feb 20 '12 at 18:24
Sorry. To put it more clearly, the answer is "No." I have edited the answer to include this. – LawrenceC Feb 21 '12 at 4:24
> No. The Windows command prompt's for built-in doesn't support anything called "FORCMD". Obviously there is not a forcmd variable, I already tested that. That’s why I asked if there was one by another name. – Synetech Feb 21 '12 at 4:30
I have added further clarification. Thanks! – LawrenceC Feb 21 '12 at 4:48
Where?​​​​​​​​​ – Synetech Feb 21 '12 at 21:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .