1

I have a printer, an HP DeskJet 712C, that I cannot print to via the shell "print" command in Windows 7 or Windows XP. I think this is because this particular printer is a "software" printer, something like a "software" modem. I am, however, able to print from Word, Notepad, and other programs. Is there some command line utility that I can use to print text files from?

Aurelia Peters
  • 185
  • 1
  • 2
  • 7
  • Is it hooked up via USB or Parallel? If USB then see this: [How do I simulate a parallel (LPT) Printer with a USB Printer?](http://superuser.com/questions/182655/how-do-i-simulate-a-parallel-lpt-printer-with-a-usb-printer) – Ƭᴇcʜιᴇ007 Feb 12 '13 at 21:24
  • Parallel, I'm afraid. I've already tried printing via `print -DLPT1` to no avail. – Aurelia Peters Feb 13 '13 at 20:12

2 Answers2

2

You can use PowerShell's Out-Printer cmdlet:

Get-Content './myfile.txt' | Out-Printer

You can even specify the name of a printer to use a non-default one, like so:

'Hi!' | Out-Printer 'Send to OneNote 2016'

That lets me put the text Hi! right into OneNote.

Ben N
  • 40,045
  • 17
  • 140
  • 181
  • Hi @Ben N do you have any alternative command for older systems like windows 7 this command is working perfectly on 10 – Fathy Jun 20 '22 at 14:06
  • @Fathy I only know of printing features in PowerShell 5.1 and 7.x. It might be possible to install PowerShell 5.1, e.g. with [this update package](https://www.microsoft.com/en-us/download/details.aspx?id=54616), but if that doesn't work you'll need to use a different program like circle's answer suggested. – Ben N Jun 20 '22 at 16:25
2

Try using the notepad command line switch /p? e.g.

notepad.exe /p "c:\test.txt"

http://answers.microsoft.com/en-us/windows/forum/windows_7-files/notepadexe-command-line-options/810760c1-a45a-4013-9544-1c1208e1b389

/A <filename> open file as ansi
/W <filename> open file as unicode
/P <filename> print filename
/PT <filename> <printername> <driverdll> <port> print filename to designated printer
circle
  • 171
  • 2