- May 24, 2010
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.