I wrote a fairly simple batch file that would capture the output of a command supplied by the user as a parameter and put it into an array. (This is done by directing the output of the command into a temporary file which is then read into an array by a "@FileArray" function. Batch file "CaptureCommandOutput.bat" is attached.) The batch file works as expected if the command parameter is a "Dir" command, for instance. However, there is no output if the command is the "Subst" command (and there are subst'd drives on the system). What is even stranger is that the following error message is output twice (there are three subst'd drives in my test situation):
TCC: (Sys) Z:\CaptureCommandOutput.bat [14] Access is denied.
"Z:\Development"
While I don't really need this functionality for the intended use of this code (the @TrueName function handles subst'd drives just fine, I was just testing), I thought it was worth mentioning. I will note two relevant facts: 1. The output of the "Subst" command is being written to the temporary file just fine. (This is indicated by the "type" command that is in the script for testing purposes.) 2. The lines that are the output from the "Subst" command contain ">"'s (greater-than symbols). Since this is used for STDOUT redirection in DOS\TCMD etc., I can't help but wonder if their presence is what is causing the problem. (I made a file with those characters in it and read it by making "Type GreaterThansFile.txt" (also attached) as the parameter; and it doesn't work properly either, although the specific symptoms are somewhat different than when the parameter is the "Subst" command.) Just reporting what is a probably a minor issue. (Assuming that is what the problem is, it is somewhat strange that a batch file can't handle data that contains specific special characters - and this could be a significan problem in some cases.)
TCC: (Sys) Z:\CaptureCommandOutput.bat [14] Access is denied.
"Z:\Development"
While I don't really need this functionality for the intended use of this code (the @TrueName function handles subst'd drives just fine, I was just testing), I thought it was worth mentioning. I will note two relevant facts: 1. The output of the "Subst" command is being written to the temporary file just fine. (This is indicated by the "type" command that is in the script for testing purposes.) 2. The lines that are the output from the "Subst" command contain ">"'s (greater-than symbols). Since this is used for STDOUT redirection in DOS\TCMD etc., I can't help but wonder if their presence is what is causing the problem. (I made a file with those characters in it and read it by making "Type GreaterThansFile.txt" (also attached) as the parameter; and it doesn't work properly either, although the specific symptoms are somewhat different than when the parameter is the "Subst" command.) Just reporting what is a probably a minor issue. (Assuming that is what the problem is, it is somewhat strange that a batch file can't handle data that contains specific special characters - and this could be a significan problem in some cases.)