title: edit list of printers in Batch
body: <p>I'm trying to get a list of printers(maybe even the IP or port its using) from a remote PC, print to a text file and remove the blank lines and "name=" so it is just a list. In the end, I'll be using this list to create a re-image list along with the Ipconfig info it already picks up. I get that currently, it's running on the local machine.</p>
  
  <p>PrinterList.bat</p>
  
  <pre><code>@echo off
  wmic printer get name /value &gt; print.txt
  for /f %%a in (print.txt) do (
  echo %%a
  )
  
  rem findstr /v /r /c:"^$" /c:"^\ *$" "print.txt" &gt;&gt; "print.txt"
  rem findstr /v /r /c:"^$" /c:"^\ *$" /c:"^\*$" "print.txt" &gt;&gt; "print.txt"
  )
  pause
  </code></pre>
  
  <p>The Commented out lines are already tried samples from the web, tailored to the specific txt file</p>
  
  <p>Output of print.txt - "&lt;>" being a blank line with no spaces</p>
  
  <pre><code>&lt;&gt;
  &lt;&gt;
  Name=Send To OneNote 2016
  &lt;&gt;
  Name=WebEx Document Loader
  &lt;&gt;
  Name=Ricoh m306
  </code></pre>
  
  <p>Ideal Output of print.txt<p></p>
  
  <pre><code>Send To OneNote 2016
  WebEx Document Loader
  Ricoh m306
  </code></pre>
  
  <p>I'm working on doing the same for finding getting a list of installed programs of a remote PC.</p>
  
  <p>I'd also like to edit the results of mapped drive.txt to later remap based on the output
  Mapped drives are stored to a txt file locally</p>
  
  <pre><code>:smd
  net use &gt;&gt; .\userSettings\%computername%_%username%_map.txt
  Goto :HOME
  </code></pre>
  
  <p>Output of %computername%_%username%_map.txt:</p>
  
  <pre><code>New connections will be remembered.
  &lt;&gt;
  &lt;&gt;
  Status       Local     Remote                    Network
  &lt;&gt;
  ----------------------------------------------------------------------------
  OK           H:        \\abc.abcde.abcdef.edu\home_folders\username 
                                                  Microsoft Windows Network
               S:        \\ab.abcdef.org\share   Microsoft Windows Network
  OK           X:        \\sgdm-group\packages      Microsoft Windows Network
  OK           Y:        \\sgdm-group\upload        Microsoft Windows Network
  The command completed successfully.
  </code></pre>
  
  <p>I'd like to get it down to a list of drives and letter to map it to, that way I can <code>for /f %%a in (%computername%_%username%_map.txt) do (</code> from each line and <code>net use</code> to remap them later</p>