Command line, batch, cmd, dos, console.

Practical examples for cut & paste. for /l %i in (1,1,1000) do @(sleep2 5|sclist -r winserver000|grep -i omniInet) - Does this: every 5 seconds retrieve a list of services from winserver000 and look for the service omniInet - Commands: for, sleep2.exe, sclist.exe, grep.exe for /f "tokens=2 delims=:" %i in ('ipconfig ^| grep -i Address ^| tail -n 1') do @nslookup %i | findstr/i "Name %i" - Does this: check local IP address, FQDN and actual DNS record in one run - Commands: for, ipconfig.exe, nslookup.exe, tail.exe, grep.exe, findstr.exe sc \\winserver000 config omniInet start= disabled - Does this: set the service omniInet to disabled on server winserver000 - Commands: sc.exe for /l %i in (1,1,1000) do @(sleep2 10|logparser -stats:off -rtp:-1 -i:iisw3c "SELECT TO_LOCALTIME(TO_TIMESTAMP(date, time)) AS [LocalTime], * FROM C:\Inetpub\logs\W3SVC353245345\ex100212.log WHERE LocalTime > SUB(TO_LOCALTIME(SYSTEM_TIMESTAMP()), TIMESTAMP('0000-01-01 00:10', 'yyyy-MM-dd HH:mm')) and cs-username like '%SERVER001%' and cs-username not like '%user001'") - Does this: every 10 seconds get the last requests in the last 10 minutes on the webserver not containing the user user001 - Commands: for, sleep2.exe, logparser.exe for /f "tokens=1,2,3,4 delims= " %i in ('robocopy "C:\Program Files" c:\temp /L /e /xj /nfl /ndl /njh /r:0^|findstr Bytes') do @echo %k%l - Does this: get the directory size of "C:\Program Files" - Commands: for, robocopy.exe, findstr.exe for /l %i in (1,1,12) do (if %i LSS 10 (@md 0%i) else (@md %i)) - Does this: creates folders 01, 02, 03, ..., 12 in your current location - Commands: for, if, md
© 2006 Javier Hernandez. All rights reserved. Terms of Use