Print text file from command line without shell "print" command
9,741
Solution 1
Try using the notepad command line switch /p? e.g.
notepad.exe /p "c:\test.txt"
/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
Solution 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.
Related videos on Youtube
Author by
Kit Peters
Ham, call sign W0KEH. Programmer / Linux guy turned broadcast engineer.
Updated on September 18, 2022Comments
-
Kit Peters almost 2 years
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?
-
Ƭᴇcʜιᴇ007 over 11 yearsIs it hooked up via USB or Parallel? If USB then see this: How do I simulate a parallel (LPT) Printer with a USB Printer?
-
Kit Peters over 11 yearsParallel, I'm afraid. I've already tried printing via
print -DLPT1
to no avail.
-