Copy file to a printer using a batch file

D

david.au

Using the GUI I can printer a file by copying it to a printer.
Can I create a batch file that will do the same thing? How?

ie copy a selected file (full path) to a designated printer,
thus invoking the appropriate program as per the usual method.

For the purpose of an example, say ...

print c:\data\sample.pdf on FS1800
============ ======

Thanks to anyone who can help.

David Kinston
melbourne.au
 
K

Ken Blake, MVP

david.au said:
Using the GUI I can printer a file by copying it to a printer.
Can I create a batch file that will do the same thing? How?


If the printer is connected to a parallel point, use the following line

COPY /b \path\filename.prn LPT1:

If it's on a USB port, set the printer to Shared, and make note of the name
that you give it.

Then go to Start | Run, and enter the line

NET USE LPT1 \\name of your computer\shared name of printer

You will now be able to issue the command

COPY /b \path\filename.prn LPT1:
 
D

david.au

Thanks Ken

As luck would have it, the printer is the main workgroup
printer and is on a local TCP port (192.168.0.200)
rather than USB or parallel.

Its name is actually FS3800.

As the printer is available to all PCs on the network
it is not currently 'shared' but that would be easy to change.

Do you need any more info in order to help?

Much appreciated.

David
 
K

Ken Blake, MVP

david.au said:
Thanks Ken


You're welcome. Glad to help.

As luck would have it, the printer is the main workgroup
printer and is on a local TCP port (192.168.0.200)
rather than USB or parallel.

Its name is actually FS3800.

As the printer is available to all PCs on the network
it is not currently 'shared' but that would be easy to change.

Do you need any more info in order to help?


Then can't you follow the instructions below?
 
D

david.au

Ken

The commands were accepted (I used LPT3 to make the
batch file more widely compatible).

Tried it out, attempting to print a 3-page PDF document.

The printer spewed out about 50 pages of garbage - looks
like the file was treated as binary data rather than a PDF
file requiring Acrobat to print it.

DK
 
H

HeyBub

david.au said:
Ken

The commands were accepted (I used LPT3 to make the
batch file more widely compatible).

Tried it out, attempting to print a 3-page PDF document.

The printer spewed out about 50 pages of garbage - looks
like the file was treated as binary data rather than a PDF
file requiring Acrobat to print it.

Sure. A PDF file is not a print file; it is data.
 
K

Ken Blake, MVP

david.au said:
Ken

The commands were accepted (I used LPT3 to make the
batch file more widely compatible).

Tried it out, attempting to print a 3-page PDF document.

The printer spewed out about 50 pages of garbage - looks
like the file was treated as binary data rather than a PDF
file requiring Acrobat to print it.


Did you send the pdf file directly to the printer? No, you can never do
that. What you have to do is run Adobe Acrobat (or Adobe Reader) and print
the pdf file to a file . That printed-to-a file file (normally, but not
necessarily with a .PRN extension) is the only kind of file you can print
this way

Print to a file from Acrobat to print a .pdf file, from Word to print a .doc
file, from Exxcel to print an xls file, etc..Without first going through the
appropraite program, there's no way to print anything but a txt file.

Also note that to create the PRN file, you have to first define a "printer"
that's a print-to-file printer and install the driver for the actual printer
you're going to use.

Sorry, since you said "Using the GUI I can printer a file by copying it to a
printer," I had assumed that you understood this. You never explained why
you wanted to do it, and it may be possible that now that you understand
what you have to do, you may no longer want to do it.

Printing to a file isn't generally useful to most people, but I've used it
for example when every month someone was E-mailing me the output of a
program he was running. I needed a hard copy of his output for publication
in a newsletter, but I didn't have the application installed on my computer.
So I had him print it to a file, using the printer driver for *my* printer,
not his, and then E-mail me the resulting PRN file. I then was able to
simply copy it to LPT1 when it arrived here.

--
Ken Blake - Microsoft MVP Windows: Shell/User
Please reply to the newsgroup
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top