rvicker has asked for the wisdom of the Perl Monks concerning the following question:

I have a user with an ancient perl application that prints directly to an equally ancient dot matrix printer. Under Windows 7 and 10 I was able to use "NET USE LPT1: \\LOCALHOST\DOTMATRIX" to get it to print. Now the user has a new PC with Windows 11 and never gets paper output. I found that it does create a file "lpt1" with the contents needed. The code to actually print: open(F, '>LPT1') or die ("Can't open printer: $!"); print F $s; close F; What is missing that it doesn't seem to use the device mapping under Windows 11? Thanks.

Replies are listed 'Best First'.
Re: Missing Print output
by GrandFather (Saint) on Sep 19, 2022 at 23:50 UTC
Re: Missing Print output to LPT on Win11
by Discipulus (Canon) on Sep 20, 2022 at 08:46 UTC
    Hello rvicker and welcome to the monastery and to the wonderful world of Perl!

    It seems they made another mess with win11.. :)

    You can check the output of mode and chgport commands and manually see the WIN + x -> Device Manager list of ports (select also the option to see hidden devices). Maybe you need to install Legacy Devices to see the port, not sure.

    The printfil program claims to be an available solution, but double check it: I never used it. You may need DOSBox-Megabuild to print to LPT: see their FAQs.

    HtH

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
Re: Missing Print output
by Marshall (Canon) on Sep 19, 2022 at 22:58 UTC
    There can be some big trouble here. That you can create an LPT1 file is ominous and a bad sign. LPT1 is a reserved name on Win 10 and a file with that name cannot be created, because that name is reserved for a device. On Win10:
    C:>echo "asdf" >LPT1 The system cannot find the file specified.
    What hardware are you using? Do you have an LPT port on the computer? That would surprise me - how are you connecting the printer?