title: CMD/Batch: How to use the output of a FOR /F loop in another set of commands
body: <p>New to stackoverflow and coding in general. I was able to write a batch that parses a text file for a set of IP address of the sonos players on a network, I was also able to write a separate batch that uses those IP address to execute the HTTP command to turn the wifi off on all units at once, but I had to input all of the IP addresses from the first batch manually. I want to know if there's a way I can input the IP address automatically into the second batch file, or if there's a way I can write a single batch file which will do everything in one go. The example below is only dealing with 2 IPs, real world I would need this to work with 20+ so that's why I want to find a way to automate the input of the IPs</p>
  
  <p>Any help is greatly appreciated!</p>
  
  <p>First Batch: GetIPlist.bat</p>
  
  <pre><code>FOR /F "tokens=3 delims= " %%a in ('findstr "IP Address: *[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*" AboutMySonos.txt') DO echo %%a
  </code></pre>
  
  <p>Which returns the following list of IPs:</p>
  
  <pre><code>192.168.2.174 
  192.168.2.24 
  </code></pre>
  
  <p>Second Batch: SonosWifiDefeat.bat</p>
  
  <pre><code>@echo off
  
  start "http://IpAddress:1400/wifictrl?wifi=persist-off" 
  ping 1.1.1.1 -n 1 -w 1000 &gt; nul
  start "http://IpAddress:1400/wifictrl?wifi=persist-off" 
  </code></pre>