JSI Tip 6065. Adprintx freeware manages printers from the command line.


Download Adprintx freeware to manage printers from the command line.

The readme.txt file contains:

    DOCUMENT:     AdPrintX Readme

    AUTHOR:       James Hart ([email protected])

    CREATED:      3 May 2002




    - To install network printers for Windows 9x systems it is 
      necessary for the appropriate printer drivers to be available 
      on the system.  See below for further information.

    - AdPrintX has been tested on Windows 95® and Windows 98® 
      (preliminary testing only), Windows NT®, Windows 2000® and 
      Windows XP®.  Has NOT been tested on Windows ME®.


    - AdPrintX is available as freeware and, as such, provides no 
      guarantee.  Any usage of this utility is completely at the 
      users own risk.


    - Microsoft network administrators


    - AdPrintX is a utility to manage Windows® network printers from 
      the command line.  It was originally designed to complement
      client printer management for Windows Terminal Server® and 
      Citrix® environments, as well as other network printer control.


    - AdPrintX is very similar to Microsoft's Zero Administration Kit
      printer management utility Con2Prt, but has additional 
      functionality, including compatibility with Windows 9x systems.

    - AdPrintX is based on Con2Prt's parameters and should be able to
      directly replace Con2Prt with AdPrintX for Windows NT or later
      systems to control network printers - BUT PLEASE DO YOUR 

    - AdPrintX provides for the removal of a single network printer
      (see "/r" option in usage), as wells all network printers (see
      "/f" option in usage).

    WINDOWS 9x -

    - in Win9x, both local and network printers are controlled by
      the local print processor and must have the appropriate drivers
      available on the system.  You can achieve this in a number of 
      ways -

          - install the printer drivers via the Windows print manager

          - copy the appropriate drivers to the system and then let
            AdPrintX install the driver

            TIP: if you print a test page for a locally installed 
                 printer it will generally list the drivers and 
                 everything else you need to know to install the 

          - whatever other way you can dream up...

    - Win9x requires additional parameters to be filled to add a
      printer.  You will need to specify driver name (/n) and driver 
      file (/s) parameters, plus a name for the printer (/p).  

      TIP: Use " ()" as the printers name
           so as not to clash with the same printer name from another


    \[ /? | /h | /l | /v | /f | \[/r "\\server\\printer" \] |
        \[/c "\\server\printer" | /cd "\\server\printer"
         /p "Printer Name" | /n "Driver Model"
         /s "driverpath\filename" \[ /t "datatype" = "EMF" \] \] \]


    /? or /h  - help
    /l        - list all installed and connected printers
    /v        - verbose operation (displays messages)
    /c or /cd - UNC of network printer (e.g. "\\server\\printer")
    /p        - printer name (e.g. "MyPrinter (MyServer)" *
    /n        - driver name (e.g. "Canon LBP-8 III") *
    /s        - driver path (e.g. "c:\windows\system\canonlbp.drv") *
    /t        - datatype (e.g. "RAW" - default is "EMF") *
    /d or /cd - make printer the default (e.g. "\\server\printer")
    /r        - remove network printer connection (e.g. "\\server\printer")
    /f        - remove all network printer connection

    - * used by Win9x only

    - order of parameters is not important

    - Win9x specific parameters are ignored by WinNT or higher systems

    - sequence of operation is -

        - list installed printers
        - remove single printer
        - remove all printers
        - add printer
        - set default printer


    - AdPrintX.exe


    IMPORTANT: multiple lines used in examples is for readability only

    - remove a network printer and add a printer and sets it as the 
      default (messages are displayed) -

         AdPrintX.exe /v /r "\\MySvr\hplaser" /cd "\\MySvr\canon lbp" 
                      /p "Canon LBP-8 (MySvr)" /n "Canon LBP-8 III" 
                      /s "c:\windows\system\canonlbp.drv"

      NOTE: this will work for both Win9x and WinNT (or higher) systems

    - add a printer (WinNT or higher only) -

         AdPrintX.exe /c "\\MySvr\canon lbp" 

    - remove a printer (all Windows versions) -

         AdPrintX.exe /r "\\MySvr\canon lbp" 

    - list all installed printers -

         AdPrintX.exe /l

    - remove all network printers (messages are displayed) -

         AdPrintX.exe /f /v

    NOTES -

    - always place double quotes around parameter values to ensure
      the argument is read correctly including its spaces (e.g. 
      "\\MySvr\canon lbp").

    - sometimes the command prompt window in Win9x will not hold the 
      required command line.  As a work around move these commands 
      to a batch file.


    - this example can be used in a Kix script to install a printer
      on either Win9x or (>=) WinNT systems.  The beauty of this set
      up is if you wish to change the server from where your users
      print you need only change the $PrintSvr variable to the name
      of your new print server (this is assuming your printer and its
      share name is the same) -

        $DblQ = Chr(34)

        ; print server
        $PrintSvr   = "\\MySvr"

        ; local kix path
        $KixPath = "c:\kix"

        ; assign command line
        $AdPrintX_Cmd = 
           "/cd " + $DblQ + $PrintSvr + "\hp laser" + $DblQ + " " +
           "/p "  + $DblQ + "HP Laser (" + LCASE(SUBSTR( $PrintSvr, 3, LEN($PrintSvr))) + ")" + $DblQ + " " +
           "/n "  + $DblQ + "HP Laserjet 4Si" + $DblQ + " " +
           "/s "  + $DblQ + "c:\windows\system\hppcl5ms.drv" + $DblQ + " " +
           "/t "  + $DblQ + "RAW" + $DblQ + " "

        IF GetFileAttr( $KixPath + "\AdPrintX.exe" ) > 0

           ; call AdPrintX
           SHELL $KixPath + "\AdPrintX.exe /v " + $AdPrintX_Cmd

           IF @ERROR  0

              ? "Error occurred...AdPrinX returned error..."

           END IF


           ? "Error occurred...could not find path..."



    Version 1.00.001  (previous version n/a)


    - n/a

    BUG LIST -

    - none known


    - include indication of the default printer when listing printers

    - include flag to specify printer memory (??)

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.