Need printer .bat or .vbs file

Hello,

I would like to be able to have a user double click on either a .bat file or .vbs file to install a local printer on our LAN. Below is the information.

IP: 10.0.6.10
Name: Cannon iR 6570
Driver Path: \\nas1\Drivers\Printer\CannoniR6570

LVL 4
asp_net2Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mrroonieCommented:
this has been asked before - http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/Q_20740983.html 

i think a batch file would be easiest
0
asp_net2Author Commented:
I don't have a print server. The printer is just is part of the LAN. All IT staff has to manually select TCP/IP from port and then enter IP address and then add the path for the printer driver. It would be nice for all this info to be in either a .bat file or .vbs file.
0
mrroonieCommented:
Is the printer directly on the |LAN or shared thru a PC?
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

asp_net2Author Commented:
directly on the LAN
0
mrroonieCommented:
maybe vbs would be your best option then - http://forums.techarena.in/xp-print-fax/937795.htm
0
asp_net2Author Commented:
I know how to use GOOGLE to. I saw that tutorial already and i'm only working with one printer and do not want to delete other printers installed. Please let me know if you can't help anymore with this. I have GOOGLE enough sites and looking for help/examples.
0
asp_net2Author Commented:
i have tried the following below from Post 22960003 but it will not install my printer that is connected to our LAN.


SET P1=%PRINTER1
IF NOT EXIST C:\TEMP\%P1%.TXT GOTO :I1
GOTO :EOF
I1
SET P1=%HP LaserJet10.0.10.19
SET PIP1=%110.0.10.19
SET PNAME1=%"HP LaserJet 4250dtn"
SET PDRIVER1=%"C:\Documents and Settings\user\Desktop\hpc4x50b.ini"
cscript.exe c:\windows\system32\prnport.vbs -a -r %P1% -h %PIP1% -o raw -n 9100
rundll32 printui.dll PrintUIEntry /if /b %P1% /f %PDRIVER1% /r %P1% /m %PNAME1% /z
P1 > C:\TEMP\%P1%.TXT
0
AmazingTechCommented:
What are those %s for?

Try it this.
SET P1=PRINTER1
IF NOT EXIST C:\TEMP\%P1%.TXT GOTO :I1
GOTO :EOF
I1
SET P1=HP LaserJet10.0.10.19
SET PIP1=110.0.10.19
SET PNAME1="HP LaserJet 4250dtn"
SET PDRIVER1="C:\Documents and Settings\user\Desktop\hpc4x50b.ini"
cscript.exe c:\windows\system32\prnport.vbs -a -r %P1% -h %PIP1% -o raw -n 9100
rundll32 printui.dll PrintUIEntry /if /b %P1% /f %PDRIVER1% /r %P1% /m %PNAME1% /z 
ECHO P1 > C:\TEMP\%P1%.TXT

Open in new window

0
asp_net2Author Commented:
:( Still no luck. When i double click on the .bat file it just flashes and nothing else happens.
0
AmazingTechCommented:
Opps the label was setup properly.
SET P1=PRINTER1
IF NOT EXIST C:\TEMP\%P1%.TXT GOTO :I1
GOTO :EOF
:I1
SET P1=HP LaserJet10.0.10.19
SET PIP1=110.0.10.19
SET PNAME1="HP LaserJet 4250dtn"
SET PDRIVER1="C:\Documents and Settings\user\Desktop\hpc4x50b.ini"
cscript.exe c:\windows\system32\prnport.vbs -a -r %P1% -h %PIP1% -o raw -n 9100
rundll32 printui.dll PrintUIEntry /if /b %P1% /f %PDRIVER1% /r %P1% /m %PNAME1% /z 
ECHO P1 > C:\TEMP\%P1%.TXT

Open in new window

0
asp_net2Author Commented:
almost there :) now when i run it i recieve the following error below.

"The arguments are invalid"
0
asp_net2Author Commented:
okay i made a little change and got a different message below.

Operation could not be completed. Windows cannot locate a suitable printer driver. Contact your system admiistrator for help locating and installing a suitable driver.
0
AmazingTechCommented:
I think:

SET PDRIVER1="C:\Documents and Settings\user\Desktop\hpc4x50b.ini"

Should point to an .inf file. Maybe putting the printer driver on a server share is a better idea too.



0
asp_net2Author Commented:
yeah, i saw that mistake and fixed it but got the same error message. What i did was i went to HP's site and extracted all files on my desktop so that i can try to get this to work with the drivers on my machine and the printer is on my LAN.
0
asp_net2Author Commented:
i added the drivers to my NAS box and still get the same error message.
0
AmazingTechCommented:
OK. How about this?

Need quotes in rundll32.

I thin this is wrong too

SET PIP1=10.0.10.19

SET P1=PRINTER1
IF NOT EXIST C:\TEMP\%P1%.TXT GOTO :I1
GOTO :EOF
:I1
SET P1=HP LaserJet10.0.10.19
SET PIP1=10.0.10.19
SET PNAME1="HP LaserJet 4250dtn"
SET PDRIVER1="C:\Documents and Settings\user\Desktop\hpc4x50b.inf"
cscript.exe c:\windows\system32\prnport.vbs -a -r "%P1%" -h "%PIP1%" -o raw -n 9100
rundll32 printui.dll PrintUIEntry /if /b "%P1%" /f %PDRIVER1% /r "%P1%" /m %PNAME1% /z 
ECHO P1 > C:\TEMP\%P1%.TXT

Open in new window

0
AmazingTechCommented:
Oh yeah I also included quotes in the cscript command line.
0
asp_net2Author Commented:
:(  Same thing!
0
AmazingTechCommented:
The port should be created.
0
AmazingTechCommented:
Ok. Downloaded the PCL6 driver. You need to reference the name of the driver that's inside the inf file.

SET P1=PRINTER1
IF NOT EXIST C:\TEMP\%P1%.TXT GOTO :I1
GOTO :EOF
:I1
SET P1=HP LaserJet10.0.10.19
SET PIP1=10.0.10.19
SET PNAME1="HP LaserJet 4250dtn"
SET PDRIVERNAME1="HP LaserJet 4250 PCL 6"
SET PDRIVER1="C:\HP LJ4200-4300 Series PCL6 Driver\hpc4x50c.inf"
cscript.exe c:\windows\system32\prnport.vbs -a -r "%P1%" -h "%PIP1%" -o raw -n 9100
rundll32 printui.dll PrintUIEntry /if /b %PNAME1% /f %PDRIVER1% /r "%P1%" /m %PDRIVERNAME1% /z 
ECHO P1 > C:\TEMP\%P1%.TXT

Open in new window

0
AmazingTechCommented:
Opps. Missed the quotes again. OK. I'm changing all sets so they are consistent.
SET P1=PRINTER1
IF NOT EXIST C:\TEMP\%P1%.TXT GOTO :I1
GOTO :EOF
:I1
SET P1=HP LaserJet10.0.10.19
SET PIP1=10.0.10.19
SET PNAME1=HP LaserJet 4250dtn
SET PDRIVERNAME1=HP LaserJet 4250 PCL 6
SET PDRIVER1=C:\HP LJ4200-4300 Series PCL6 Driver\hpc4x50c.inf
cscript.exe c:\windows\system32\prnport.vbs -a -r "%P1%" -h "%PIP1%" -o raw -n 9100
rundll32 printui.dll PrintUIEntry /if /b "%PNAME1%" /f "%PDRIVER1%" /r "%P1%" /m "%PDRIVERNAME1%" /z 
ECHO P1 > C:\TEMP\%P1%.TXT

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
asp_net2Author Commented:
NICE!!! That worked out GREAT. Your title fits your skills. It did work but the only little anoying problem is that i had to close the dos command window. Also, is there a switch to make that the default printer?
0
asp_net2Author Commented:
Hi AmazingTech,

Everything worked out great as i needed. I only have to ask you a dumb question. What type of language is being used here in this .bat file??
0
AmazingTechCommented:
.bat or .cmd is DOS batch scripting. Essentially when you open a command prompt and type in a command you can put all those individual commands together in a .bat or .cmd to run them sequentially.
0
asp_net2Author Commented:
okay, so if i want to learn more would i google "DOS batch scripting" or .bat or .cmd scription?

thanks in advance!!
0
AmazingTechCommented:
Yup those keywords should do. Also "Batch files"
0
asp_net2Author Commented:
Thanks again for all  your help and patients!!!

Take care!!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.