DetailPage-MSS-KB

Microsoft small business knowledge base

Article ID: 43075 - Last Review: September 30, 2003 - Revision: 3.0

This article was previously published under Q43075

SUMMARY

If a batch file is used as the command in a FOR batch command, the FOR batch command only calls the batch file once. The following interactive example executes ONE.BAT for item "a", then stops:
    FOR %i IN (a b c d) DO one %i
				
In a batch file, use two percent examples. The change in the example above is as follows:
    FOR %%i IN (a b c d) DO one %%i
				

MORE INFORMATION

In Microsoft the MS-DOS packaged product, the CALL command can be used to repeatedly execute the batch file with the FOR batch command. The above interactive example is changed to the following:
    FOR %i IN (a b c d) DO CALL one %i
				
This example executes ONE.BAT for each item in the list.

In releases of MS-DOS earlier than version 3.30, this can be done by spawning COMMAND.COM with the /C switch and letting it execute the batch file. The above interactive example is changed to the following:
    FOR %i IN (a b c d) DO COMMAND /C ONE %i
				

APPLIES TO
  • Microsoft MS-DOS 6.22 Standard Edition
Keywords: 
KB43075
Share
Additional support options
Ask The Microsoft Small Business Support Community
Contact Microsoft Small Business Support
Find Microsoft Small Business Support Certified Partner
Find a Microsoft Store For In-Person Small Business Support