Batch file to print only 33 lines
Results 1 to 4 of 4

Thread: Batch file to print only 33 lines

  1. #1
    Registered User
    Join Date
    May 2005
    Posts
    1

    Batch file to print only 33 lines

    I need help writing a batch file to load at startup and direct the dot matrix printer to print only 33 lines of the 66 lines normally on a 8 1/2 X 11 page.

    I'm using a Panasonic KX-P3123 3000LE Series

    I did this once before, but I forgot how I did it.

    Frank

  2. #2
    Registered User
    Join Date
    Sep 2000
    Posts
    218
    Are you trying to print 33 lines of a file, or trying to set the printer to 33-line mode?

    If you want to print 33 lines of a file, there is no easy way to do that in DOS or using batch commands - you have to use a 3rd party utility or write a little qbasic script.

    If you are just trying to send data to the printer, the easiest way is to redirect the ECHO statement.

    for instance, assuming your printer is on the first parallel port:

    ECHO This is a test > LPT1

    Will print "This is a test" to the printer. You would have to look up the control codes for the printer to get the 33 line setting, but from that point it should be as simple as echoing the control characters into the printer.

  3. #3
    Intel Mod Platypus's Avatar
    Join Date
    Jan 2001
    Location
    Australia
    Posts
    5,783
    It does sound a bit like page length of 33 lines is required.

    If so, and if the printer accepts ESC/P language, I think using Esc C 33 in ShadowWynd's suggested sequence might work.

    You can create the Esc character in DOS Edit with the sequence Control P then Control [, and it will appear as a left-pointing arrow.

    So the line in the batch file would be ECHO Esc C 33 > LPT1: (or PRN: in the place of LPT1: if unsure of the printer port number).

    Hope I've figured this right, don't have a dot matrix set up at the moment...

  4. #4
    Registered User Vip2's Avatar
    Join Date
    Jul 2003
    Posts
    44

    Post

    Quote Originally Posted by ShadowWynd
    Are you trying to print 33 lines of a file, or trying to set the printer to 33-line mode?

    If you want to print 33 lines of a file, there is no easy way to do that in DOS or using batch commands - you have to use a 3rd party utility or write a little qbasic script.
    It's actually not too bad with a batch file:

    set count=0
    FOR /F "tokens=*" %%G IN (myfile.txt) DO (call :count "%%G")
    goto :eof

    :count
    echo %1 >> printfile.txt
    set /a count+=1
    if %count%==33 (
    type printfile.txt
    del printfile.txt
    exit)
    goto :eof

    To print to a printer instead, replace the "type printfile.txt" with a "print printfile.txt > lpt1"

    Of course there probably is an even easier way...

Similar Threads

  1. Wanna see a routing loop?
    By silencio in forum Networking
    Replies: 2
    Last Post: May 31st, 2005, 12:09 PM
  2. Edit the registry from a bat file
    By alistair91 in forum Windows XP
    Replies: 2
    Last Post: August 31st, 2004, 12:10 PM
  3. batch file help
    By sp3tiger in forum Windows NT/2000
    Replies: 3
    Last Post: January 18th, 2003, 01:11 PM
  4. [RESOLVED] NTbackup batch file
    By chaucer in forum Networking
    Replies: 12
    Last Post: March 21st, 2001, 10:57 AM
  5. [RESOLVED] Fatal Error - VFAT problem, need help
    By KevinPKT in forum Windows 95/98/98SE/ME
    Replies: 3
    Last Post: February 8th, 2001, 10:49 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •