Printing a Text File from Command Prompt

16,517

Solution 1

Try this :

START /MIN NOTEPAD /P yourfile.txt

Solution 2

I'd try

copy /b yourfilename yourportname

where yourportname may be PRN: or LPT1: or whatever.

Share:
16,517
BIT CHEETAH
Author by

BIT CHEETAH

→ Follow BIT CHEETAH to keep your web-figure sexy :. :. :.

Updated on June 04, 2022

Comments

  • BIT CHEETAH
    BIT CHEETAH almost 2 years

    Alright, this is outside my area of expertise but so here's what I'm trying to do:

    → I have a POS (Point of Sale) receipt printer. I have the drivers installed for it and can print a test page with it. I can also print from notepad++ (for example), although it leaves a lot of empty space. This printer is set as the default printer.

    → I want to be able to print a single line to the printer using some automated process in Windows. My initial thought was to have the line I wanted to print in a text file and then to use:

    print C:\filename.txt
    

    from Command Prompt. However, this results in

    C:\filename.txt is currently being printed
    

    but nothing is printed. I am unfamiliar with ESC/POS and do not understand where to incorporate those commands either. Basically, printing a txt file from Command Prompt is my first necessity though. Any help?

    • Niels Keurentjes
      Niels Keurentjes about 11 years
      Since this is not a programming question, it is offtopic on Stack Overflow. You might want to try on superuser.com/?as=1, not sure it'll be ontopic there though.
    • BIT CHEETAH
      BIT CHEETAH about 11 years
      I am programming a batch file and need this command to work for the batch file to work. I believe batch files are still considered programming.
    • BIT CHEETAH
      BIT CHEETAH about 11 years
      Also, someone may have a solution that involves Python of which I am more familiar, but the task seems capable of being done via a batch file.
  • Magoo
    Magoo about 11 years
    Having said that though, it would be raw bytes delivered to the printer - noth through any drivers. That's the way I run POS or label printers. The text you'd need to deliver would need to be in accordance with that particular printer's individual Printer Control Language - and there's no standard. That's what the driver does - convert Windows-talk to the particular printer's PCL.
  • M--
    M-- almost 7 years
    What's the port name for AdobePDF printer? I tried googling it but couldn't get my hands on something.