I’m writing a windows batch file and need to check whether the print exists on the local computer, and if so, deletes the mapped printer from the computer. Here is the code that I’m using to delete the printer.
RUNDLL32 printui.dll,PrintUIEntry /n \\server\printerName /dn
This works fine, but now I need a conditional statement before this so I check if that printer exists first. Then run that line. I’m not sure how to write this.
You could try something like this, just replace the string to find with the printer you want to find.
Or just run the command and if it doesn’t exist it will error, if it does it will work?
Hope this helps!