Patrick-Dussault

Windows :: For Loop : Sample

Blog Post created by Patrick-Dussault Employee on Jan 13, 2016

Here is a sample of a for loop in Windows Dos shell :

 

    for %i IN (BIOS CPU ENVIRONMENT OS QFE) DO wmic %i list full /format:htable > %i.html

 

which means for each value in (), run wmic command with the value in parameter, and redirect the output to a file of the name of the value with extension .html

 

To get more information, run

 

    c:\> for /?

Outcomes