By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,805 Members | 1,241 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,805 IT Pros & Developers. It's quick & easy.

Map/Add a printer in .bat file

P: 22
I am able to map shares/network drives using a bat file but not able to map printers

ADD SHARES
net use [drive letter]: \\server\share

ADD PRINTER
net use \\server\printer

The script shows command completed successfully when executed but I don't see the printers in XP printers and faxes. What am I doing wrong?

Thanks to all for replies
Apr 2 '07 #1
Share this Question
Share on Google+
4 Replies


Expert 5K+
P: 8,434
I am able to map shares/network drives using a bat file but not able to map printers

ADD SHARES
net use [drive letter]: \\server\share

ADD PRINTER
net use \\server\printer

The script shows command completed successfully when executed but I don't see the printers in XP printers and faxes. What am I doing wrong?
From reading the online help for NET USE, it looks as though it must be used to assign the printer to a port (LPT1, etc).
Apr 2 '07 #2

P: 22
From reading the online help for NET USE, it looks as though it must be used to assign the printer to a port (LPT1, etc).

AHA! Found it

Expand|Select|Wrap|Line Numbers
  1. REM Add printer
  2. echo Installing [printer name] on [servername]!
  3. RunDll32.EXE printui.dll,PrintUIEntry /in /n \\server\printer
  4.  
  5. echo Your default printer is [printername] on [server]
  6. REM Set Default Printer 
  7. RunDll32.EXE printui.dll,PrintUIEntry /y /n \\server\printer
outputs a file name printers, but used del command @ end of script to delete that file. The file as well is somewhat random, so I also used "if exists" command.
thanks for the reply, hope this helps other users as well
Apr 3 '07 #3

Expert 5K+
P: 8,434
AHA! Found it
...
thanks for the reply, hope this helps other users as well
Glad you got it working. Thanks for the info, this will be invaluable for anyone in a similar situation.
Apr 3 '07 #4

P: 1
AHA! Found it

REM Add printer
echo Installing [printer name] on [servername]!
RunDll32.EXE printui.dll,PrintUIEntry /in /n \\server\printer

echo Your default printer is [printername] on [server]
REM Set Default Printer
RunDll32.EXE printui.dll,PrintUIEntry /y /n \\server\printer

outputs a file name printers, but used del command @ end of script to delete that file. The file as well is somewhat random, so I also used "if exists" command.
thanks for the reply, hope this helps other users as well
Thank you so much, this is just what I was lookig for.
Apr 13 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.