In loop FOR /F there is very good block separator delims= tokens=. But
I'm frustrated that delims can hold only 1 symbol. But I want to extract
from list only machines which run on 'Windows 2000' like:
FOR /F "delims='Windows 2000' tokens=2" %%i in (genlist.txt) do systeminfo /s %%i
File genlist.txt was produced by listing all the computers on network:
@echo off
FOR /F %%i in ('net view ^| find ""') do echo %%i
FOR /F (Windows loop) How to make delims not singl
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
FOR /F (Windows loop) How to make delims not singl
delims=xxx - specifies a delimiter set. This replaces the default delimiter set of space and tab.
Delimiters in 'delim' argument are a collection of characters used to break a line into tokens like spaces, commas or semi-colons. They are treated one character at a time.
delim=,.;:|!{}[]
delim should not be used to try and match string in a file. Use FINDSTR to find lines that contain a specific string.
FOR /F (Windows loop) How to make delims not singl
Here is a better way to get the matching OS types from the network:
http://support.microsoft.com/servicedes ... eusage.asp
jvierra2010-12-23 10:01:34
Code: Select all
wmic /node:ws001,ws002,alpha os get csname,name | find /i "Windows 2000"
wmic /node:@"c:computers.txt" os get csname,name | find /i "Windows 2000"
wmic /node:@"c:computers.txt" os get csname,name | find /i "Windows 2000" /format:csv
wmic /OUTPUT:output.csv /node:@servers.txt OS get csname,name /format:csv
wmic /node:@"c:computers.txt" os get csname,name | find /i "Windows 2000" /format:rawxml.xsl
wmic /node:@"c:computers.txt" path win32_operatingsystem where "name like '%2000%'" get csname,name
http://support.microsoft.com/servicedes ... eusage.asp
jvierra2010-12-23 10:01:34