Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Print command in a batch file

320 views
Skip to first unread message

David

unread,
Aug 25, 1999, 3:00:00 AM8/25/99
to
Hi all

I am trying to use the Print command within a batch file to print a
local file to a network printer. In Dos, I get a message saying print
job is being sent, and return to prompt. But nothing ever joins the
print queue. This is what I am doing :

using isql to extract info, and then creating a file (test.txt) with
the info.

I then try : print C:\test\test.txt within the batch file, but no
printout. I tried it in Dos as well, with no luck.

The printer is a networked printer, off one of our servers. Any ideas
on how to fix this.

Thanks a lot

David


Tom Lavedas

unread,
Aug 25, 1999, 3:00:00 AM8/25/99
to

Print is a kind of print spooler, normally linked to LPT1. It is not
really necessary to send files to a printer, the COPY command will
suffice. Further, are you sure the printer is connected at the 'DOS'
level. A NET /STATUS should show all logins and mappings available at
the command prompt (and thereby to the batch process). Clearly, there
is a disconnect. It is possible all of your attempts are still in
PRINT's queue (or they might have just been sent to the byte bucket).

I believe you can simply use ...

copy C:\test\test.txt LPTn

if the port number 'n' is already properly mapped or

copy C:\test\test.txt \\servername\printername

if it's not.

Tom Lavedas
-----------
http://www.pressroom.com/~tglbatch/

Raymond Zeitler

unread,
Aug 25, 1999, 3:00:00 AM8/25/99
to
I would add the /B switch to that copy statement. While test.txt is probably
all text, the info David is extracting with isql might not be.

In article <37C415...@pressroom.com>, lav...@pressroom.com says...

je...@oxmol.co.uk

unread,
Aug 26, 1999, 3:00:00 AM8/26/99
to david...@public.usa.com
Hi David,

You could try using my shareware printing utility, Imprint,
to print your files. It can be run from a batch file or
dos window, but not from a machine running in dos mode.

It has many options for modifying the output of the text
files it prints, for example the font used, the line spacing,
the header/footer information, line wrapping. It is also
easy to specify which printer the file should be sent to.

Jon

--------------------------------------------------------------------
Jon Eva mailto:jon...@gallicrow.co.uk
Gallicrow Software Limited http://www.gallicrow.co.uk
Home of Imprint - a utility for printing text and binary files
--------------------------------------------------------------------

In article <37c3fad2...@news.ftech.net>,


David wrote:
>
> I am trying to use the Print command within a batch file to print a
> local file to a network printer. In Dos, I get a message saying print
> job is being sent, and return to prompt. But nothing ever joins the
> print queue. This is what I am doing :
>
> using isql to extract info, and then creating a file (test.txt) with
> the info.
>
> I then try : print C:\test\test.txt within the batch file, but no
> printout. I tried it in Dos as well, with no luck.
>
> The printer is a networked printer, off one of our servers. Any ideas
> on how to fix this.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.

Tom Lavedas

unread,
Aug 26, 1999, 3:00:00 AM8/26/99
to
Raymond Zeitler wrote:
>
> I would add the /B switch to that copy statement. While test.txt is
> probably all text, the info David is extracting with isql might not be.

Absolutely! A very good point.

BTW, text files can also be sent to the 'default Windows printer' using
Notepad with a /P command line switch, as in ...

notepad /p c:\test\test.txt

or ...

start /W notepad /p c:\test\test.txt

if it is desired to have the procedure wait for the print job to finish
before continuing (though I can't think of why that would be of
interest). I thought of that after I had posted the response yesterday.

> In article <37C415...@pressroom.com>, lav...@pressroom.com says...
> > David wrote:
> > >
> > > Hi all
> > >

> > > I am trying to use the Print command within a batch file to print a
> > > local file to a network printer. In Dos, I get a message saying print
> > > job is being sent, and return to prompt. But nothing ever joins the
> > > print queue. This is what I am doing :
> > >
> > > using isql to extract info, and then creating a file (test.txt) with
> > > the info.
> > >
> > > I then try : print C:\test\test.txt within the batch file, but no
> > > printout. I tried it in Dos as well, with no luck.
> > >
> > > The printer is a networked printer, off one of our servers. Any ideas
> > > on how to fix this.
> > >

Raymond Zeitler

unread,
Aug 30, 1999, 3:00:00 AM8/30/99
to
True, but Notepad includes a header and footer on each page of the printout
by default. Also, the font you get depends (I believe) on whatever font was
used in the most recent Notepad session. Still, it's handy just to right-
click on the file and select Print.

In article <37C536...@pressroom.com>, lav...@pressroom.com says...

0 new messages