How to create a .prn file?

  • Thread starter Thread starter Sid Elbow
  • Start date Start date
S

Sid Elbow

Guest
I'm trying to create a print file from a word document that I can send
to a printer from the command line.

I went to <Start> <Settings> <Printers>, opened the properties for the
printer involved and set the printer port to "Print to a File". I then
went through the print dialogue from Winword, gave it a filename and
apparently created a print file.

Unfortunately, whenever I do this I get a zero byte file. Am I missing
something.


(The reason I'm trying to do this is that I have a long-standing problem
with inkjet printers in that, because my usage is relatively infrequent,
when I do come to need the inkjet it's invariably got a dried-up nozzle
that I have to spend time, paper and ink cleaning. I felt that I could
avoid this by creating a short, simple, multicoloured text string in
word and sending it to the printer perhaps every day or two to exercise
it without wasting too much ink. However, I'd like to do this
automatically and the only way I can think of is by sending the document
via a command line in a startup .bat file. And for that, I assume I'd
need the document in print file form).
 
Re: How to create a .prn file?


"Sid Elbow" <here@there.com> wrote in message
news:47c3074c$0$10317$c3e8da3@news.astraweb.com...
> I'm trying to create a print file from a word document that I can send to
> a printer from the command line.
>
> I went to <Start> <Settings> <Printers>, opened the properties for the
> printer involved and set the printer port to "Print to a File". I then
> went through the print dialogue from Winword, gave it a filename and
> apparently created a print file.
>
> Unfortunately, whenever I do this I get a zero byte file. Am I missing
> something.
>
>
> (The reason I'm trying to do this is that I have a long-standing problem
> with inkjet printers in that, because my usage is relatively infrequent,
> when I do come to need the inkjet it's invariably got a dried-up nozzle
> that I have to spend time, paper and ink cleaning. I felt that I could
> avoid this by creating a short, simple, multicoloured text string in word
> and sending it to the printer perhaps every day or two to exercise it
> without wasting too much ink. However, I'd like to do this automatically
> and the only way I can think of is by sending the document via a command
> line in a startup .bat file. And for that, I assume I'd need the document
> in print file form).


Instead of modifying the printer setup, try doing it the easy way:
- Open your document
- Click File / Print
- Tick the box "Print to File"
- Specify a destination when prompted.
 
Re: How to create a .prn file?

Pegasus (MVP) wrote:
> "Sid Elbow" <here@there.com> wrote in message
> news:47c3074c$0$10317$c3e8da3@news.astraweb.com...
>> I'm trying to create a print file from a word document that I can send to
>> a printer from the command line.


> Instead of modifying the printer setup, try doing it the easy way:
> - Open your document
> - Click File / Print
> - Tick the box "Print to File"
> - Specify a destination when prompted.


<Blush> You know I looked everywhere for that box in the print dialogue
before changing the printer setup and couldn't for the life of me see
it. Thanks

In any event, I still get a zero-byte file. However, I tried selecting
my other (Laser) printer (and printing to a file) and it worked OK then.
So I have to assume it's a printer driver problem on the inkjet.
 
Re: How to create a .prn file?

Sid Elbow <here@there.com> wrote in news:47c3074c$0$10317$c3e8da3
@news.astraweb.com:

> I'm trying to create a print file from a word document that I can send
> to a printer from the command line.
>
> I went to <Start> <Settings> <Printers>, opened the properties for the
> printer involved and set the printer port to "Print to a File". I then
> went through the print dialogue from Winword, gave it a filename and
> apparently created a print file.
>
> Unfortunately, whenever I do this I get a zero byte file. Am I missing
> something.
>
>
> (The reason I'm trying to do this is that I have a long-standing

problem
> with inkjet printers in that, because my usage is relatively

infrequent,
> when I do come to need the inkjet it's invariably got a dried-up nozzle
> that I have to spend time, paper and ink cleaning. I felt that I could
> avoid this by creating a short, simple, multicoloured text string in
> word and sending it to the printer perhaps every day or two to exercise
> it without wasting too much ink. However, I'd like to do this
> automatically and the only way I can think of is by sending the

document
> via a command line in a startup .bat file. And for that, I assume I'd
> need the document in print file form).


If you can create the document in Wordpad, you can print it with a
command-line like this (no .PRN file needed):
"c:\Program Files\Windows NT\Accessories\WORDPAD.EXE"/p yourfilename
 
Re: How to create a .prn file?


"Sid Elbow" <here@there.com> wrote in message
news:0303d6d1$0$25869$c3e8da3@news.astraweb.com...
> Pegasus (MVP) wrote:
>> "Sid Elbow" <here@there.com> wrote in message
>> news:47c3074c$0$10317$c3e8da3@news.astraweb.com...
>>> I'm trying to create a print file from a word document that I can send
>>> to a printer from the command line.

>
>> Instead of modifying the printer setup, try doing it the easy way:
>> - Open your document
>> - Click File / Print
>> - Tick the box "Print to File"
>> - Specify a destination when prompted.

>
> <Blush> You know I looked everywhere for that box in the print dialogue
> before changing the printer setup and couldn't for the life of me see it.
> Thanks
>
> In any event, I still get a zero-byte file. However, I tried selecting my
> other (Laser) printer (and printing to a file) and it worked OK then. So I
> have to assume it's a printer driver problem on the inkjet.


Thanks for the feedback - glad you resolved it.
 
Re: How to create a .prn file?

Mark Blain wrote:

> If you can create the document in Wordpad, you can print it with a
> command-line like this (no .PRN file needed):
> "c:\Program Files\Windows NT\Accessories\WORDPAD.EXE"/p yourfilename


I'd looked for a command-line execution with winword and couldn't find
one. Didn't think of Wordpad.

The only problem I see is that this form of command line would
presumably print to the default printer ... which the printer in
question is not (and given that I use it only occasionally, I don't want
to make it the default).
 
Re: How to create a .prn file?

Pegasus (MVP) wrote:
> "Sid Elbow" <here@there.com> wrote in message


>> In any event, I still get a zero-byte file. However, I tried selecting my
>> other (Laser) printer (and printing to a file) and it worked OK then. So I
>> have to assume it's a printer driver problem on the inkjet.

>
> Thanks for the feedback - glad you resolved it.


Well, I wouldn't call it "resolved" but it would seem not to be a
Windows problem.

In fact, when I print to a file, the HP toolbox opens which likely
indicates that the driver is trying to get status information from the
printer - an old HP 1220C - although I don't know why it should. If that
is so, it won't be able to because one of the self-confessed bugs in the
driver software, (of all releases) for this product is that the status
interrogation doesn't work if you connect via parallel port. Which means
that many of the HP toolbox functions (such as ink level status etc)
just plain don't work. Apparently printing to a file doesn't either.
HP's workaround, throughout the life of the printer, was to tell you to
connect via USB instead (!).
 
Re: How to create a .prn file?

Sid Elbow wrote:
> Pegasus (MVP) wrote:
>> "Sid Elbow" <here@there.com> wrote in message

>
>>> In any event, I still get a zero-byte file. However, I tried
>>> selecting my other (Laser) printer (and printing to a file) and it
>>> worked OK then. So I have to assume it's a printer driver problem on
>>> the inkjet.

>>
>> Thanks for the feedback - glad you resolved it.

>
> Well, I wouldn't call it "resolved" but it would seem not to be a
> Windows problem.


OK, I found a way around the problem ... I had a driver for this printer
installed on another machine and, even though the printer wasn't
connected, it would correctly write the printfile. I then took the
printfile back to the first machine, sent it to LPT1: from the command
line and it printed just fine.

My question now is how to do this from a startup batch file. I don't
want it going off at every reboot. Once a day would be OK if I have to
but I think every two or three days or so would be fine. Can I do that
with basic batch file commands or do I need an added utility to do the
timing? (There's nothing particularly critical about the timing so
"trick" programming would be OK).
 
Re: How to create a .prn file?


"Sid Elbow" <here@there.com> wrote in message
news:47c44adb$0$24411$c3e8da3@news.astraweb.com...
> Sid Elbow wrote:
>> Pegasus (MVP) wrote:
>>> "Sid Elbow" <here@there.com> wrote in message

>>
>>>> In any event, I still get a zero-byte file. However, I tried selecting
>>>> my other (Laser) printer (and printing to a file) and it worked OK
>>>> then. So I have to assume it's a printer driver problem on the inkjet.
>>>
>>> Thanks for the feedback - glad you resolved it.

>>
>> Well, I wouldn't call it "resolved" but it would seem not to be a Windows
>> problem.

>
> OK, I found a way around the problem ... I had a driver for this printer
> installed on another machine and, even though the printer wasn't
> connected, it would correctly write the printfile. I then took the
> printfile back to the first machine, sent it to LPT1: from the command
> line and it printed just fine.
>
> My question now is how to do this from a startup batch file. I don't want
> it going off at every reboot. Once a day would be OK if I have to but I
> think every two or three days or so would be fine. Can I do that with
> basic batch file commands or do I need an added utility to do the timing?
> (There's nothing particularly critical about the timing so "trick"
> programming would be OK).


If you invoked this batch file at boot time then it would fire
only once each day:
@echo off
set Target=c:\TrackerFolder
if not exist "%Target%" md "%Target%"
if not exist "%Target%\LastPrint.txt" goto Action

for /F "tokens=1-2" %%a in ('dir "%Target%\LastPrint.txt" ^
^| find /i "LastPrint.txt"') do set FDate=%%a %%b
if "%FDate%"=="%date%" goto :eof

:Action
echo. > "%Target%\LastPrint.txt"
rem Your command goes here
 
Re: How to create a .prn file?

Pegasus (MVP) wrote:

> If you invoked this batch file at boot time then it would fire
> only once each day:
> @echo off
> set Target=c:\TrackerFolder
> if not exist "%Target%" md "%Target%"
> if not exist "%Target%\LastPrint.txt" goto Action
>
> for /F "tokens=1-2" %%a in ('dir "%Target%\LastPrint.txt" ^
> ^| find /i "LastPrint.txt"') do set FDate=%%a %%b
> if "%FDate%"=="%date%" goto :eof
>
> :Action
> echo. > "%Target%\LastPrint.txt"
> rem Your command goes here


Thanks, Pegasus, I'll try that.

I've also been reading about AT.EXE and SCHTASKS.EXE which might help.

Appreciate the help. This is going to solve all my inkjet printer
problems (I hope).
 
Re: How to create a .prn file?


"Sid Elbow" <here@there.com> wrote in message
news:47c44adb$0$24411$c3e8da3@news.astraweb.com...
> Sid Elbow wrote:
> > Pegasus (MVP) wrote:
> >> "Sid Elbow" <here@there.com> wrote in message

> >
> >>> In any event, I still get a zero-byte file. However, I tried
> >>> selecting my other (Laser) printer (and printing to a file) and it
> >>> worked OK then. So I have to assume it's a printer driver problem on
> >>> the inkjet.
> >>
> >> Thanks for the feedback - glad you resolved it.

> >
> > Well, I wouldn't call it "resolved" but it would seem not to be a
> > Windows problem.

>
> OK, I found a way around the problem ... I had a driver for this printer
> installed on another machine and, even though the printer wasn't
> connected, it would correctly write the printfile. I then took the
> printfile back to the first machine, sent it to LPT1: from the command
> line and it printed just fine.
>
> My question now is how to do this from a startup batch file. I don't
> want it going off at every reboot. Once a day would be OK if I have to
> but I think every two or three days or so would be fine. Can I do that
> with basic batch file commands or do I need an added utility to do the
> timing? (There's nothing particularly critical about the timing so
> "trick" programming would be OK).


Use the Task Scheduler to set it to run when you want.

Check the command-line <at> command in the helpfile:

At
Schedules commands and programs to run on a computer
at a specified time and date. You can use at only when the
Schedule service is running. Used without parameters,
at lists scheduled commands.
 
Re: How to create a .prn file?

V Green wrote:

> Use the Task Scheduler to set it to run when you want.
>
> Check the command-line <at> command in the helpfile:


I first set up Pegasus's batch file and got that running OK. Then I
started playing around with schtasks.exe (XP replacement for at.exe).
I'll probably end up using the latter since once a week (rather than
once a day) may be enough. (I'd rather try something like every three
days but that seems a bit too complicated).
 
Re: How to create a .prn file?



Sid Elbow wrote:
> V Green wrote:
>
>> Use the Task Scheduler to set it to run when you want.
>>
>> Check the command-line <at> command in the helpfile:

>
>
> I first set up Pegasus's batch file and got that running OK. Then I
> started playing around with schtasks.exe (XP replacement for at.exe).
> I'll probably end up using the latter since once a week (rather than
> once a day) may be enough. (I'd rather try something like every three
> days but that seems a bit too complicated).


You could set the schedule as Weekly and pick say "Mondays" and
"Thursdays". That's pretty close to "every three days" and not complicated.
 
Re: How to create a .prn file?

Bob I wrote:

> Sid Elbow wrote:



>> I started playing around with schtasks.exe .....
>> I'll probably end up using the latter since once a week (rather than
>> once a day) may be enough. (I'd rather try something like every three
>> days but that seems a bit too complicated).


> You could set the schedule as Weekly and pick say "Mondays" and
> "Thursdays". That's pretty close to "every three days" and not complicated.



I wasn't aware you could do that Bob. I thought when you set /SC WEEKLY
it meant once per week and you then picked one day of the week for it
to occur.


In fact the help file states in part:

/D specifies the day of the week to run the task

/M specifies month(s) of the year

Which would seem to imply that you can specify multiple months (where
appropriate) but not multiple days.


Perhaps I'm reading too much into it? If you can pick several days, that
would do it fine. I'll play some more, thanks.
 
Re: How to create a .prn file?



Sid Elbow wrote:

> Bob I wrote:
>
>> Sid Elbow wrote:

>
>
>
>>> I started playing around with schtasks.exe ..... I'll probably end up
>>> using the latter since once a week (rather than once a day) may be
>>> enough. (I'd rather try something like every three days but that
>>> seems a bit too complicated).

>
>
>> You could set the schedule as Weekly and pick say "Mondays" and
>> "Thursdays". That's pretty close to "every three days" and not
>> complicated.

>
>
>
> I wasn't aware you could do that Bob. I thought when you set /SC WEEKLY
> it meant once per week and you then picked one day of the week for it
> to occur.
>
>
> In fact the help file states in part:
>
> /D specifies the day of the week to run the task
>
> /M specifies month(s) of the year
>
> Which would seem to imply that you can specify multiple months (where
> appropriate) but not multiple days.
>
>
> Perhaps I'm reading too much into it? If you can pick several days, that
> would do it fine. I'll play some more, thanks.
>


Try using the Scheduled tasks Wizard, and then check the Schedule tab. I
don't have a 2000 box any more. If that option isn't available, as a
work around, you could have 2 tasks one for each day.
 
Re: How to create a .prn file?



Sid Elbow wrote:

> Bob I wrote:
>
>> Sid Elbow wrote:

>
>
>
>>> I started playing around with schtasks.exe ..... I'll probably end up
>>> using the latter since once a week (rather than once a day) may be
>>> enough. (I'd rather try something like every three days but that
>>> seems a bit too complicated).

>
>
>> You could set the schedule as Weekly and pick say "Mondays" and
>> "Thursdays". That's pretty close to "every three days" and not
>> complicated.

>
>
>
> I wasn't aware you could do that Bob. I thought when you set /SC WEEKLY
> it meant once per week and you then picked one day of the week for it
> to occur.
>
>
> In fact the help file states in part:
>
> /D specifies the day of the week to run the task
>
> /M specifies month(s) of the year
>
> Which would seem to imply that you can specify multiple months (where
> appropriate) but not multiple days.
>
>
> Perhaps I'm reading too much into it? If you can pick several days, that
> would do it fine. I'll play some more, thanks.
>


Also here is another method

Example:
at \\products 23:00 /every:M,T,W,Th,F backup

How To Use the AT Command to Schedule Tasks
http://support.microsoft.com/kb/313565
 
Re: How to create a .prn file?

Bob I wrote:

> as a work around, you could have 2 tasks one for each day.


I had a real chuckle when I read that. It seems so obvious ...... now
that you've mentioned it :-)
 
Re: How to create a .prn file?



Sid Elbow wrote:
> Bob I wrote:
>
>> as a work around, you could have 2 tasks one for each day.

>
>
> I had a real chuckle when I read that. It seems so obvious ...... now
> that you've mentioned it :-)
>


Glad to make you grin, sometimes we have to make do with what's
available. ;-)
 
Back
Top