How can I print a textfile on the command prompt in Windows?



As an IT administrator, you may have come across the need to print a text file from the Windows command prompt. This can be a useful task, especially when dealing with large files that would be cumbersome to print from a regular application. Fortunately, the print capabilities of the Windows command prompt are relatively straightforward, and the following steps will help you get the job done.

The first step is to open the command prompt. To do this, press the Windows key, type “cmd”, and press Enter. Once the command prompt is open, you need to navigate to the folder where the text file is located. To do this, use the “cd” command followed by the path to the folder that contains the text file. For example, if the text file is located in the “C:\\Documents” folder, you would type “cd C:\\Documents” and press Enter.

Once you have navigated to the folder containing the text file, you can use the “type” command to view the contents of the file. To do this, type “type filename.txt” and press Enter, where “filename.txt” is the name of the file you want to view. If you want to print the contents of the file, you can use the “print” command followed by the name of the file. For example, if the file is named “myfile.txt”, you would type “print myfile.txt” and press Enter.

If you want to customize the print settings, you can use the “print /D” command followed by the name of the printer and the name of the file. For example, if the printer’s name is “My Printer” and the file is named “myfile.txt”, you would type “print /D My Printer myfile.txt” and press Enter. This will open a dialog box where you can adjust the print settings, such as the number of copies, paper size, and color.

If you want to print multiple files at once, you can use the “copy” command followed by the names of the files. For example, if you want to print the files “myfile1.txt”, “myfile2.txt”, and “myfile3.txt”, you would type “copy myfile1.txt + myfile2.txt + myfile3.txt” and press Enter. This will copy the contents of all three files into a single file which can then be printed using the “print” command.

Finally, if you want to print a range of pages from a text file, you can use the “print /P” command followed by the range of pages and the name of the file. For example, if you want to print pages 10 to 15 of the file “myfile.txt”, you would type “print /P 10-15 myfile.txt” and press Enter. This will print only the pages specified in the range.

As you can see, the Windows command prompt provides a variety of options for printing text files. From viewing the contents of a file to printing multiple files at once, the command prompt is a powerful tool for managing text files. With a few simple commands, you can quickly and easily print a text file from the Windows command prompt.

Inquire Now

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Find your next full or part-time role here

ScaleDesk can either help you find your next full time gig or a part time side gig where you can create extra income!

Onboard with us once
Skip HR screening and go to the final interview with with only your resume and a video interview you never have to redo
Get paid electronically every month for the hours you work
We will be your reference even if you work for us once

IT Teams: Use ScaleDesk to augment your team

Schedule Demo