Simple Print Batch Dos Program

Hi,

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

Print.bat
=======
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
NicksonKohAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bill PrewCommented:
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.

~bp
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
NicksonKohAuthor Commented:
Thanks.
0
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.
0
NicksonKohAuthor Commented:
Thx. That work.

Also, there is no problem printing pdf, excel or word directly through this method.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft DOS

From novice to tech pro — start learning today.