Map/Add a printer in .bat file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Lloydm
    New Member
    • Feb 2007
    • 22

    #1

    Map/Add a printer in .bat file

    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\printe r

    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
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    Originally posted by Lloydm
    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\printe r

    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).

    Comment

    • Lloydm
      New Member
      • Feb 2007
      • 22

      #3
      Originally posted by Killer42
      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

      Code:
      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
      Last edited by Killer42; Apr 14 '07, 03:51 AM. Reason: Added CODE tags

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        Originally posted by Lloydm
        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.

        Comment

        • hebro
          New Member
          • Apr 2007
          • 1

          #5
          Originally posted by Lloydm
          AHA! Found it

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

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

          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.

          Comment

          Working...