0

How can I send output to a shared printer from MSYS2? I mapped a printer using

NET USE LPT1 \\home-pc\sysprint /persistent: yes

and I can use it from a command prompt:

dir >lpt1:

or a PowerShell prompt:

dir >\\tom-home-pc\sysprint

but neither of those work in MSYS2 nor in OpenCOBOL which uses MSYS2.

What am I missing?

I tried redirecting output to the device name (LPT1:) and the share name (\home-pc\sysprint)

I expected to get the output on the shared printer but LPT1: created a file called LPT1: and the share name did nothing.

  • `mingw` and `msys` are likely much better tags than `shared`... Nonetheless - if you want to use a \ in msys terminal (which is shell), then you'd need to escape them with another one, so you may want to try `dir >\\\\tom-home-pc\\sysprint`. Concerning OpenCOBOL (if you are on MSYS2 then you'll likely use the maintained GnuCOBOL instead): What happens if you `net use` to LPT1, verify it works from cmd.exe, then start a COBOL program which uses `OPEN OUTPUT prt-file` which has `SELECT prt-file ASSIGN TO "LTP1"`? – Simon Sobisch May 31 '23 at 08:23

0 Answers0