Guest KMyers1 Posted September 13, 2009 Posted September 13, 2009 On Sep 12, 4:07Â pm, Pegasus wrote: > Since this is far from a trivial set of batch files, you should ask > the batch file experts in alt.msdos.batch.nt for advice. They love > this type of challenge!- Hide quoted text - > Actually, if you look a little closer you will find those batch files are really quite simple. They both essentially boil down to executing some FOR commands that look similar to this: for /f "tokens=4 usebackq" %%a in ('a b c d e f g h') do echo %%a According to the docs, that command should produce the command "echo d", which should in turn echo the d character to the screen. In fact that does happen. However, quite often, under some circumstances that I'm not completely sure of, it also produces a garbled error message *after* the echo command. The error message is usually "The system cannot find the file " followed by some graphics characters, but sometimes it is more messed up than that. Sometimes I get this error after executing a command similar to the above only once, other times it takes more tries. It appears to be affected but not eliminated by use of "set local enabledelayedexpansion". Here is a simple test that you can try. I have tested this on two different machines, both running Windows XP Service Pack 3 with all critical updates installed. The results includes garbled error messages on both machines. Copy the following into a batch file on your machine, then run the batch file from a command prompt. @echo off for /f "tokens=4 usebackq" %%a in ('a b c d e f g h') do echo %%a for /f "tokens=4 usebackq" %%b in ('a b c d e f g h') do echo %%b for /f "tokens=4 usebackq" %%c in ('a b c d e f g h') do echo %%c for /f "tokens=4 usebackq" %%d in ('a b c d e f g h') do echo %%d for /f "tokens=4 usebackq" %%e in ('a b c d e f g h') do echo %%e for /f "tokens=4 usebackq" %%f in ('a b c d e f g h') do echo %%f for /f "tokens=4 usebackq" %%g in ('a b c d e f g h') do echo %%g for /f "tokens=4 usebackq" %%h in ('a b c d e f g h') do echo %%h for /f "tokens=4 usebackq" %%i in ('a b c d e f g h') do echo %%i for /f "tokens=4 usebackq" %%j in ('a b c d e f g h') do echo %%j for /f "tokens=4 usebackq" %%k in ('a b c d e f g h') do echo %%k for /f "tokens=4 usebackq" %%l in ('a b c d e f g h') do echo %%l for /f "tokens=4 usebackq" %%m in ('a b c d e f g h') do echo %%m for /f "tokens=4 usebackq" %%n in ('a b c d e f g h') do echo %%n for /f "tokens=4 usebackq" %%o in ('a b c d e f g h') do echo %%o for /f "tokens=4 usebackq" %%p in ('a b c d e f g h') do echo %%p Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.