Minor "For" issue...

May 24, 2010
Northlake, Il
While I would not call this a major problem because it has a very simple work around, I would say that it is something that does not work as one would expect. Specifically, the command "For /R %Root %F in (*.Example) Do (Echo %F) >&>ErrorFile.txt" does not work if "%Root" contains the drive letter of a non-existent drive ("Q:\", for example), and in this case it starts and recurses from the current directory on the current drive with the error file ("ErrorFile.txt") remaining empty. Again, there is a not all that inconvenient but possibly rather inefficient work around; specifically replacing the above by "For /R %Root %F in (*.example) Do (If EXIST %Root Echo %F)" does work. Similarly, if "%Root" contains the name of a non-existent directory on an existing drive, the same thing happens, again starting the recursion from the current directory on the current drive. I will note that if the error output is not redirected to a file the error message(s) are displayed, so maybe the real problem has something to do with redirecting standard error to a file in this situation. But in any case I tend to think that the command should not execute at all rather than starting the recursion from the current drive and directory.
May 20, 2008
Elkridge, MD, USA
From: mathewsdw
Summary of OP:

| for /r DR %x in (*) do ...

| If the path DR does not exist, either because it references a directory on a drive not ready, or because the specified directory does | not exist on the drive (though the drive is ready), FOR reports the error, and proceeds to execute in the current directory.

Problem verified using TCC 12.11.73 on WinXP home SP3 (32b).
Similar threads
Thread starter Title Forum Replies Date
Alpengreis Documentation Minor issue in help file for view /E Support 1
R Minor Cosmetic Issue in Take Command Window Support 2
M A minor but annoying issue with the "MD" command... Support 20
S SETARRAY - minor issue Support 0
S BDEBUGGER - minor issue Support 2
gschizas Minor (really minor) registration issue Support 0
Peter Murschall Some minor flaws Support 15
D WAD Minor Post Installation Bug in V18 Support 1
dcantor Help file minor error Support 0
D Minor problem. Incorrect value internal var _dir_files Support 7
jbanaszczyk help files: minor inconsistency Support 2
D Fixed Minor problem: output not alligned in the tree command Support 1
S Suggested minor improvements for www.jpsoft.com Support 5
M Just a minor annoyance re one particular plugin... Support 25
M Just a minor oddity... Support 9
Dan Glynhampton Documentation v15 help: Minor niggles Support 0
Dan Glynhampton Documentation Minor issues with HELP Support 0
M A minor complaint... Support 9
M A (minor) limitation of @FileSize... Support 6
Charles Dye Minor nit: DIR /F, IFTP, colorization Support 4
vefatica Install two minor versions Support 4
A minor documentation fix - command line editing Support 0
A del /w [minor documentation fix] Support 0
A Minor documentation fix ["-" on command line] Support 3
Roedy WAD Minor long-standing install problems Support 6
R A couple of minor issues with new forum. Support 4
M A somewhat humorous minor-request related to "Shift" command... Support 4
gschizas (minor) Help topic "Colors, Color Names and Codes" is wrong Support 0
M A question about new behavior that’s a minor irritation… Support 16
M An undocumented limitation and an associated minor bug... Support 1
H Minor bug in v12 SENDMAIL Support 0
J ZIP Help - minor quibble Support 0
S Virtual disk detection, minor enhancement requests Support 0
S Minor HELP issues Support 1
Charles Dye Minor installer quirk Support 1
J goto compat issue makes all node/npm wrapper scripts fail to run... Support 2
cgunhouse TCToolBar /W Issue Support 2
G v28 Display Issue Support 7
Jay Sage Issue with CD_ENTER Alias Support 37
Jay Sage Issue with CD_LEAVE Alias Support 3
fpefpe How to? issue with % and evaluation Support 5
cgunhouse Standard User Account Issue Support 2
samintz WAD Display wrapping issue Support 5
M TCC color issue in ConEmu Support 4
samintz Timer issue Support 4
samintz WAD ANSI issue Support 3
D TCSTART issue after reinstallation Support 14
A Documentation [Help file] OPTION "//" synopsis formatting issue Support 0
Chen Touboul Overtyping issue - i press the Insert key, help till press enter for new line in TCC Support 2
Y TCC and Cmder imcompatibility issue Support 7

Similar threads