Batch Script Help Needed
Posted on 2010-09-23
I am trying to run a command using a Batch file script to change a printer name if it exists. Here's the rundown of the PseudoCode I am trying to accomplish.
If "Zebra LP2844" Printer name exists
Change printer name to ComputerName_LP2844
Now the command to change the printer name is:
rundll32 PrintuUI.DLL,PrintUIEntry /XS /n "Zebra LP2844" PrinterName "%COMPUTERNAME%_LP2844"
This however assumes there is a printer specifically named "Zebra LP2844" otherwise it gives an error, which is something I need it to not do. I thought an IF statement would be best but a try catch would be fine to handle the error, it doesn't matter so long as the end user never sees the error and the printer name is changed if it is incorrect. Thanks.