A. Normally, you can use a logon script. However, if you want to run a command or copy a file to every machine, you can use the following command.
net view > list.txt
This command outputs a list of current machines to the file list.txt. You can then parse that file to perform an operation (e.g., to copy files).
FOR /F " tokens=1 " %i in (list.txt) do copy quaropts.dat "%i\C$\program files\navnt"
If you placed this command in a file, you would need to use two percentage signs (i.e., %%), as follows.
FOR /F " tokens=1 " %%i in (list.txt) do copy quaropts.dat "%%i\C$\program files\navnt"
You could change the for command as follows to avoid using a temporary file.
FOR /F " tokens=1 " %i in ('net view') do copy quaropts.dat "%i\C$\program files\navnt"
End of Article


FOR /F "tokens=1,2 delims=\ " %%A in ('browstat vw 1 \\ServerX') do (CALL :STEP1 %%A)
This tokens statement strips out the leading back slashes - The reason I sometime strip them out is because some tools don't use the slashes and it's easier to strip them and if need be add them back if you need both in a shell script.
You could use "net view" as well - but I tend to use browstat against a DC in an NT4 environment where browsing is working well -
Joel Krall April 17, 2003