0

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?

1
  • 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
    Commented May 18, 2013 at 22:08

1 Answer 1

1

No.

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 command.com - 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. command.com, 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 command.com 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.

10
  • I am familiar with everything you said. None of that was an answer to the question I asked.
    – Synetech
    Commented Feb 20, 2012 at 18:24
  • Sorry. To put it more clearly, the answer is "No." I have edited the answer to include this.
    – LawrenceC
    Commented Feb 21, 2012 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
    Commented Feb 21, 2012 at 4:30
  • Where?​​​​​​​​​
    – Synetech
    Commented Feb 21, 2012 at 21:16
  • Check the edits to see. Also add some of your own if you have further ideas for clarification.
    – LawrenceC
    Commented Feb 22, 2012 at 1:24

You must log in to answer this question.

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