Simple Print Batch Dos Program


I am writing a batch job that accepts a filename as input for sending to print. Code as follows :

Print /D:"\\apbl-prn03\HP GCC 15th Floor" %1

Then I execute from dos as follows :
Print.bat "C:\Temp\Test.pdf"

The %1 parameter is not working. Am I doing this wrong? Please advise.
LVL 17
Who is Participating?
Bill PrewConnect With a Mentor Commented:
First thought, change the name of the BAT file.  You have it the same as the print.exe program, and that is likely executing rather than the BAT.  Change the name to myprint.bat for example and try that.

NicksonKohAuthor Commented:
Dave BaldwinFixer of ProblemsCommented:
Also, "print C:\Temp\Test.pdf" will not print as a PDF but only as the printable characters in the file.  PDFs must go thru a PDF reader/formatter like Adobe Reader to print properly.  I just tried it out of curiosity and it just prints a mess of characters.

About the only thing that you can print successfully from the command line like that is plain text.  If you can view it in Notepad, you can print it.  All other files formatted for other programs are going to be a problem.
NicksonKohAuthor Commented:
Thx. That work.

Also, there is no problem printing pdf, excel or word directly through this method.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.