Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Map Printer Via .bat File 1

Status
Not open for further replies.
Mar 25, 2004
146
US
Does anyone know how to call a .vbs file from a .bat file. If I can figure that out then I could just do that as I have a working .vbs file that will map a printer in windows.

If not does anyone know the commands to map a printer in windows. I have a command which will map it to lpt1 but it still doesn't show up in windows. Also is there a command to set it as default like in a vbscript file.

Thx,
Ryan
 
To map a printer via a command line:

net use lpt1: "\\server\printer name"

To remove it:

net use lpt1: /d

If it's a DOS software you are trying to map the LPT1 to, I suggest you run a batch file to attach the printer, call your software, and then delete the map upon exit.

To set a default printer or install one remotely, locally or in a script, run the DOS command:

rundll32 printui.dll,PrintUIEntry /?

It will give you all the options to play with printers and you can add this to a script or batch file also.




"In space, nobody can hear you click..."
 
Or, if you just want to call the VBS file from a batch file, use:

cscript.exe filename.vbs

 
ReddLefty,
If I use the RUNDLL method what if there is already a printer there. Will it just ignore it or will it throw up errors?
 
what if i want it to show up under controll panel-->printers???

thanks,

Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top