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"
3 comments
Hide comments