1

I am trying to create a batch file for my helpdesk that is going to be used to test zebra printers.

Here is the batch that i created

set /p %zebra= Enter Printers name - 
set /p %server= Enter Server name - 
rundll32 printui.dll,PrintUIEntry /in /n\\%server%\%zebra%
mspaint /p test.bmp /pt %zebra%    
rundll32 printui.dll,PrintUIEntry /dl /n %zebra% /q

two things are wrong with this

  1. mspaint /p test.bmp /pt "network printer" tells me that the specified printer is invalid. The printer is there. and,
  2. rundll32 printui.dll,PrintUIEntry /dl /n %zebra% /q doesn't delete the printer that is added. i have also tried using /dn %zebra% and that didn't work either.

any suggestions?

Dullawolf
  • 23
  • 1
  • 7
  • Is "network printer" actually the name of your zebra printer? And is it installed on the PC you run this script on? – GolezTrol Oct 02 '13 at 20:13
  • You have a network printer named "network printer?" Also, take the /q option off the last rundll32 so you can see error messages. – Carey Gregory Oct 02 '13 at 20:14
  • [This looks similar](http://stackoverflow.com/questions/141052/ms-paint-command-line-switches) but it's not a dupicate. It might help... – rene Oct 02 '13 at 20:14
  • GOLEZTROL - yes, "network Printer" is the actual name of the network printer and it is installed on the machine. CAREY- i put it in quotes so i wouldn't use actual name. i have been testing without the /q. and i have been just using printui.exe instead of the rest of the command. i have the whole command should this batch be used on an xp machine. RENE- thanks for the link, i was going to mention that in my original post but forgot, i did use that as a reference before posting my question. – Dullawolf Oct 02 '13 at 20:16

2 Answers2

1

%zebra% identifies the variable 'zebra'. But in your set command you also use (one) percentage sign:

set /p %zebra= Enter Printers name - 

This causes you to set the variable %zebra, which is not the variable you read later.

This addresses only one of your problems, but I hope it helps. I cannot reproduce the other problem. Printing from the command line to a specific printer (which I didn't even know MSPaint could do) seems to work fine here. I printed to both PDFCreator and a wifi printer. Both work fine.

A general advise: Try to get each step working on the command line, before combining it all into a script and introducing variables and input. That way, if it suddenly stops working, you know you made a (probably trivial) error while adding a step like user input.

GolezTrol
  • 114,394
  • 18
  • 182
  • 210
  • http://i.imgur.com/q5G1ipz.png . as you can see from the screen shot, i am runningn a little different script. the batch in the SS sets the printer i add as default and it prints. all that works fine. the removal is what i can't get to work. i also can't print from a specific printer from paint in command line. i dont want the batch to set a printer as default. once the printer is removed, it defaults to the wrong printer. – Dullawolf Oct 02 '13 at 20:32
0

Problem is in Printer Name. It should not have spaces. HP 451 is wrong. HP_451 is working fine.