### c:\tools\504>help for | findstr "FOR" > helpfor-examples.txt
FOR %variable IN (set) DO command [command-parameters]
To use the FOR command in a batch program, specify %%variable instead
forms of the FOR command are supported:
FOR /D %variable IN (set) DO command [command-parameters]
FOR /R [[drive:]path] %variable IN (set) DO command [command-parameters]
    Walks the directory tree rooted at [drive:]path, executing the FOR
FOR /L %variable IN (start,step,end) DO command [command-parameters]
FOR /F ["options"] %variable IN (file-set) DO command [command-parameters]
FOR /F ["options"] %variable IN ("string") DO command [command-parameters]
FOR /F ["options"] %variable IN ('command') DO command [command-parameters]
FOR /F ["options"] %variable IN (file-set) DO command [command-parameters]
FOR /F ["options"] %variable IN ('string') DO command [command-parameters]
FOR /F ["options"] %variable IN (`command`) DO command [command-parameters]
FOR /F "eol=; tokens=2,3* delims=, " %i in (myfile.txt) do @echo %i %j %k
    Remember, FOR variables are single-letter, case sensitive, global,
    You can also use the FOR /F parsing logic on an immediate string, by
    Finally, you can use the FOR /F command to parse the output of a
      FOR /F "usebackq delims==" %i IN (`set`) DO @echo %i
In addition, substitution of FOR variable references has been enhanced.
values.  The %~ syntax is terminated by a valid FOR variable name.

netsh interface ipv4>set address name="VMware Network Adapter VMnet1" static addr= mask=

--- old ---

A few examples from the major Windows command line tools

netsh tricks

netsh interface show interface

netsh advfirewall set allprofiles state on

netsh advfirewall set allprofiles state off

netsh advfirewall set currentprofile firewallpolicy blockinbound, allowoutbound

netsh dhcpclient trace enable

netsh wlan connect ssid="Wireless Net" name=Profile2 interface="Wireless Network Connection"

Powershell and wmic




get-help services

get-help stop-services

files and reg keys

Test-Path C: ##tab

Test-Path HKCU:SoftwareMicrosoftWindowsCurrentVersion

Service info

wmic service list brief

wmic service get /format:hform > c:folderservices.html

start services.html

wmic /node:steve-pc service list brief

Service manipulation

Suspend-Service tapisrv

Suspend-Service -displayname "telephony"

Resume-service tapisrv


get-help start-process

start notepad.exe

start-process iexplore

Stop-Process -processname iexplore

Stop-Process -processname note*

Bios and Hardware

wmic bios

Get-WmiObject Win32_Share Select Name, Path, Type FT
Get-WmiObject Win32_LogicalDisk Select Name, Size, FreeSpace
driverquery.exe /v /FO CSV ConvertFrom-CSV Select-Object 'Display Name', 'Start Mode', 'Paged Pool(bytes)', Path


Command Line Kung fu blog: []

netsh Tech Reference: []

Learn Windows PowerShell Fast Crash Course: []

Task Based Guide Powershell cmdlets: []


TN Blogs: "Using PowerShell V2 to gather info on free space on the volumes of your remote file server": []

Finding Driver Information using PowerShell, a PowerTip of the Day, from []