Q:

edit list of printers in Batch

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.
PrinterList.bat
@echo off
wmic printer get name /value > print.txt
for /f %%a in (print.txt) do (
echo %%a
)

rem findstr /v /r /c:"^$" /c:"^\ *$" "print.txt" >> "print.txt"
rem findstr /v /r /c:"^$" /c:"^\ *$" /c:"^\*$" "print.txt" >> "print.txt"
)
pause

The Commented out lines are already tried samples from the web, tailored to the specific txt file
Output of print.txt - "<>" being a blank line with no spaces
<>
<>
Name=Send To OneNote 2016
<>
Name=WebEx Document Loader
<>
Name=Ricoh m306

Ideal Output of print.txt
Send To OneNote 2016
WebEx Document Loader
Ricoh m306

I'm working on doing the same for finding getting a list of installed programs of a remote PC.
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
:smd
net use >> .\userSettings\%computername%_%username%_map.txt
Goto :HOME

Output of %computername%_%username%_map.txt:
New connections will be remembered.
<>
<>
Status       Local     Remote                    Network
<>
----------------------------------------------------------------------------
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.

I'd like to get it down to a list of drives and letter to map it to, that way I can for /f %%a in (%computername%_%username%_map.txt) do ( from each line and net use to remap them later

A:

wmic output needs special parsing to remove cr,cr,lf sequences:
@Echo off
( for /f "tokens=2 delims==" %%A in (
    'wmic printer get name /value ^|find "Name"'
  ) Do for /f "Delims=" %%B in ("%%A") Do Echo %%B
)>"print.txt"

