@PTRNAME — Returns the name of a printer.

Syntax:
%@PTRNAME[n,L|N]

na nonnegative integer
Lprinters controlled Locally
NNetwork printers

You can use this function to iterate through the names of available printers. %@PTRNAME[0] returns the name of the first printer on the system, %@PTRNAME[1] gives the name of the second, and so on. When n exceeds the number of the last printer, %@PTRNAME[n] will return an empty string.

The index n is required. If neither L nor N is specified, the function will return both locally-controlled and network printers.

for /l %i in ( 0, 1, %@dec[%_numprinters] ) echo %i %@ptrname[%i]