Brian
asked on
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\Can noniR6570
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\Can
ASKER
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.
Is the printer directly on the |LAN or shared thru a PC?
ASKER
directly on the LAN
maybe vbs would be your best option then - http://forums.techarena.in/xp-print-fax/937795.htm
ASKER
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.
ASKER
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\hpc4 x50b.ini"
cscript.exe c:\windows\system32\prnpor t.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
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\hpc4
cscript.exe c:\windows\system32\prnpor
rundll32 printui.dll PrintUIEntry /if /b %P1% /f %PDRIVER1% /r %P1% /m %PNAME1% /z
P1 > C:\TEMP\%P1%.TXT
What are those %s for?
Try it this.
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
ASKER
:( Still no luck. When i double click on the .bat file it just flashes and nothing else happens.
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
ASKER
almost there :) now when i run it i recieve the following error below.
"The arguments are invalid"
"The arguments are invalid"
ASKER
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.
Operation could not be completed. Windows cannot locate a suitable printer driver. Contact your system admiistrator for help locating and installing a suitable driver.
I think:
SET PDRIVER1="C:\Documents and Settings\user\Desktop\hpc4 x50b.ini"
Should point to an .inf file. Maybe putting the printer driver on a server share is a better idea too.
SET PDRIVER1="C:\Documents and Settings\user\Desktop\hpc4
Should point to an .inf file. Maybe putting the printer driver on a server share is a better idea too.
ASKER
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.
ASKER
i added the drivers to my NAS box and still get the same error message.
OK. How about this?
Need quotes in rundll32.
I thin this is wrong too
SET PIP1=10.0.10.19
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
Oh yeah I also included quotes in the cscript command line.
ASKER
:( Same thing!
The port should be created.
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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?
ASKER
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??
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??
.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.
ASKER
okay, so if i want to learn more would i google "DOS batch scripting" or .bat or .cmd scription?
thanks in advance!!
thanks in advance!!
Yup those keywords should do. Also "Batch files"
ASKER
Thanks again for all your help and patients!!!
Take care!!
Take care!!
i think a batch file would be easiest