write.exe giving an error when printing from .bat or .cmd

I am running windows 7 x64 Ultimate.

I have a printer named DesignJet

I am trying to create a .bat or .cmd to print a .rtf file automatically once a week to keep the ink cartridges from gumming up.

here is what I have:
write.exe /pt Print.rtf DesignJet

(write.exe is located in C:\Program Files\Windows NT\Accessories for Windows 7 and does exist!!!)

here is the problem:
The above works fine if I open cmd and type it in.

If it is in a .bat or .cmd file it will open Print.rtf but it errors out saying "Could not start print job"

What am I doing wrong here? Could someone help me please!!!
 

Question Info


Last updated February 28, 2018 Views 724 Applies to:
Answer
Answer
How did you get WRITE.EXE there?  I promise you it should not be there.  It hasn't existed for over 18 years.

 
You're referencing a LNK link (the Start menu shortcut) instead of the actual wordpad file.  Here's what you need to use in your batch file (or if this is the only command, you can just use this as your scheduled task -- no batch file needed)

"C:\Program Files\Windows NT\Accessories\wordpad.exe" /p "c:\users\joe\documents\Printjob.rtf" DesignJet

The paths to the two files (the Wordpad program and your file to print) should be in quotes, as illustrated.  Give that a go, it should work.
Shawn "Cmdr" Keene | Microsoft MVP - Windows Insider | CmdrKeene.com | tweet me: @LtCmdrKeene
Microsoft MVPs are independent experts offering real-world answers. Learn more at mvp.microsoft.com.

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

Answer
Answer
Thanks that worked putting it directly into the Task Scheduler! No .bat or .cmd needed!

Only 1 thing was wrong in the script.

/p sends it directly to the default printer so "Printer Name" at the end has no function

"C:\Program Files\Windows NT\Accessories\wordpad.exe" /p "c:\users\joe\documents\Printjob.rtf" DesignJet

/pt
sends it to the Printer of choice with "Printer Name" at the end.

"C:\Program Files\Windows NT\Accessories\wordpad.exe" /pt "c:\users\joe\documents\Printjob.rtf" DesignJet


Thank you!!!

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.