dos batch file

July 30, 2009 at 08:14:12
Specs: Windows XP
Why does this batch print file work in 98 but I can not get it to work with a parallel printer in XP?

if "%2a"= ="a" goto nospace
COPY %1 %2.txt PRN
goto end
:nospace
COPY %1.txt PRN
:end
COPY FF.DAT PRN


See More: dos batch file

Report •


#1
July 30, 2009 at 08:30:35
try lpt1 instead of prn

Report •

#2
July 30, 2009 at 09:29:20
Because the new DOS uses redirection like Linux. Try this...

if "%2a"= ="a" goto nospace
Type %1 %2.txt > LPT1
goto end
:nospace
Type %1.txt > LPT1
:end
Type FF.DAT > LPT1

The ">" tells the output to go to the file or device.


Report •

#3
July 30, 2009 at 13:28:32
from the xp technet site.

dir > prn

When you specify prn, the directory list is sent to the printer attached to the LPT1 port. If your printer is attached to a different port, you must replace prn with the name of the correct port.

You can also redirect output of the dir command to a file by replacing prn with a file name. You can also type a path. For example, to direct dir output to the file Dir.doc in the Records directory, type:

"Best Practices", Event viewer, host file, perfmon, antivirus, anti-spyware, Live CD's, backups, are in my top 10


Report •

Related Solutions

#4
August 5, 2009 at 12:52:32
when you run this batch file from the command prompt, a input window pops up "Please input parameters for the application", If you to enter a number without a space this batch file works. If there is a space in the number it does not work,an inactive dos window appears stating to many parameters or file not found. This batch file did work Win98.
i did make the changes suggested, changing the output to lpt1 instead of prn. and replaced copy command with the type command. Any other ideas?



Report •

#5
August 11, 2009 at 06:17:21
this is the batch file after changing from copy to type and from prn to lpt1

if %2a==a goto nospace
TYPE \\path\vip\%1.txt >LPT1
goto end
:nospace
TYPE \\path\%1.txt >LPT1
:end
COPY FF.DAT LPT1

if the filename does not contain a space this batch file works, but with a space in the filename it does not print it just sends the form feed at the end of the batch file. Any ideas?


Report •

#6
August 11, 2009 at 16:00:40
another option: notepad /p %1.txt

Report •


Ask Question