Differences
This shows you the differences between two versions of the page.
tech:dos:others:for_loop_in_bat [2014/11/15 09:13] |
tech:dos:others:for_loop_in_bat [2014/11/15 09:13] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== DOS Batch - For Loop ====== | ||
+ | FOR loop construct to run a given command any number of times. | ||
+ | <code> | ||
+ | FOR /l %i in (1,1,10000) DO myProg.exe | ||
+ | </code> | ||
+ | |||
+ | 2nd example | ||
+ | <code> | ||
+ | FOR /l %i in (1,1,10) DO echo %i | ||
+ | </code> | ||
+ | |||
+ | 3rd example | ||
+ | <code> | ||
+ | FOR /l %i in (1,1,3) DO telnet 192.168.1.8 77 | ||
+ | </code> | ||
+ | |||
+ | ===== Resources ===== | ||
+ | * [[http://www.dostips.com/|DosTips - The DOS Batch Guide]] | ||
+ | * [[http://www.dostips.com/DtTipsStringManipulation.php|DOS - String Manipulation]] | ||
+ | * [[http://ss64.com/nt/syntax-substring.html|variable substring | Windows CMD | SS64.com]] | ||
+ | * [[http://technet.microsoft.com/en-us/library/cc755301%28v=ws.10%29.aspx|Netsh Commands for Wireless Local Area Network (WLAN) in Windows Server 2008, works on Windows 7]] |