PDA

Click to See Complete Forum and Search --> : DOS Prompt


Nov 1st, 1999, 12:57 AM
I have a FTP program that downloads .ps files and places them in the desired directory automatically. What I want to do is print these files using the DOS command "copy [filename] lpt1" I've tried every way I could possibly think of. Using the print command in vb is no good because it doesn't print the file out. Any suggestions????

Yonatan
Nov 1st, 1999, 01:40 AM
This will print a file. The file must be in Text Format.

Sub PrintFile(ByVal sFile As String)
Dim sText As String, iFile As Byte
iFile = FreeFile
Open sFile For Input As iFile
sText = Input(LOF(iFile), iFile)
Close iFile
Printer.Print sText
Printer.EndDoc
End Sub

Usage:
Call PrintFile("C:\Autoexec.bat") ' This prints C:\Autoexec.bat on the default printer

------------------
Yonatan
Teenage Programmer
E-Mail: RZvika@netvision.net.il
ICQ: 19552879 (http://www.icq.com/19552879)

Bad5887
Nov 1st, 1999, 05:38 AM
to print a file from DOS, do this:

prn c:\file.txt

that is it!

P.S. I'm the DOS Batch-Man, I make DOS batch file games, http://bad5887.homepage.com