in reply to Raw Data to Printer on Win XP

You can redirect the LPT1 physical port to a network printer. Here is an extract from msdn.
To redirect print output for the LPT1 port to MyPrinter1 on print serv +er W2KPRN1: net use LPT1: \\W2KPRN1\MyPrinter1 To display information about the LPT1 port: net use LPT1:

Replies are listed 'Best First'.
Re^2: Raw Data to Printer on Win XP
by dvergin (Monsignor) on Sep 29, 2004 at 22:16 UTC
    Well, yes. I had thought of that (or something similar). But:
         >net use LPT1:
         System error 2 has occurred.
         The system cannot find the file specified.
    And besides, the printer is not on the network. It's attached to USB002 on my laptop (which, to my frustration, lacks a parallel port). I had figured to use MODE to redirect LPT1 to USB002. But I could not make it work. Here's a MODE status request as an example of at least part of the problem:
         >mode LPT1: /status
         Illegal device name - LPT1
    It would be great if I could activate LPT1 and then redirect it to point at USB002. Any clues?

      Does your usb device show up as a COMn: port if you do just issue the "mode" command alone?

      If so, you can redirect LPT to it using

      Redirect printing: MODE LPTn[:]=COMm[:]

      Examine what is said, not who speaks.
      "Efficiency is intelligent laziness." -David Dunham
      "Think for yourself!" - Abigail
      "Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon
        Status for device CON:
            Lines:          300
            Columns:        80
            Keyboard rate:  31
            Keyboard delay: 1
            Code page:      437
        That's it. So I guess the answer to your question is 'No'. Is there a way to configure the USB port to appear that way?
        i was of the understanding that usb printer drivers communication is different than on parallel, so i don't think it will work -- otherwise you can create any port you like in the windows printer control panel. and if the MODE thing doesn't work for you, there's a win32 port re-director called "redmon". If redirecting from lpt1 to usb works for you, please let us know.
      mode /LPT1: /status should have been successful. On my system is replies that LPT1 is not redirected. Can you print at all (outside of Perl) from the CMD prompt? There have been issues in teh past with USB printing from the cmd line. If that is an issue you may have to update your drivers.
             >print temp.txt
             Unable to initialize device PRN
        Also, Control-P (am I remembering correctly how to toggle printing of console activity?) doesn't work either. It appears as "^P" and nothing happens. Hit return and you get: "'►' is not recognized as an internal or external command, operable program or batch file."

        Is there any other way to print from the console?

        "you may have to update your drivers". Which drivers? USB?

Re^2: Raw Data to Printer on Win XP
by aquarium (Curate) on Sep 29, 2004 at 21:01 UTC
    question is how to print raw data to printer -- NOT how to re-direct a port!!!! in the plethora of options for most decent printer drivers, you get an option to print RAW data, so that's accessed through the printer's control panel. then it's only a matter of actually sending the output to the printer...which i'm not too sure on.


      I think what you are looking for is for a perl module or code that allows you to print to the Windows Print API ... you can do so using Win32::Printer. You will also want to use Win32::Printer::Enum to determine which printers are available.

      hope this helps

      Jason L. Froebe

      No one has seen what you have seen, and until that happens, we're all going to think that you're nuts. - Jack O'Neil, Stargate SG-1

        I was quite hopeful when I first ran across Win32::Printer during the course of this current quest. In fact, I went ahead and installed it for use later with other projects.

        But in reading and re-reading the docs. And in re-reading them yet again before responding to your suggestion just now, I can find no way to use that module to send a raw string as-is directly to the printer. After my eyes got "scrolled-out" I finally tried a text search for 'raw' and 'direct' in the pod. But no good.

        I'd love for you to point out the option for that module I have missed that allows such a thing.

      Since the OP has "brushed up on MODE" which alows you to re-direct printer ports I figured it was on topic. You can often also FTP directly to the newer printers. Putting a file will cause a the printer to print it, it will also bypass the print server queue. :-)
      Of course that may not solve you problem either.
      Just my 2 cents.
        Your response was on point and I thank you for it. But see my reply to yours (beginning "Well, yes. I had thought of that..." explaining that the printer is at USB002 attached directly to this laptop. And note the rest of that sub-thread including the exchange with BrowserUk.

        Is there a MODE or NET USE command (perhaps in combination with other settings) that would establish redirection of LPT1 (which currently seems to be unknown on this system) to USB002.