EDV Abmayr: Windows-Tips

Druckt man mit einem Windows-Programm, so kann man, statt direkt auf den Drucker zu drucken, die Ausgabe in eine Datei drucken. Dies kann nützlich sein,

Die Umleitung in eine Datei ist sehr einfach, allerdings weiß Windows mit dieser Datei nichts anzufangen. Mit Hilfe der folgenden Internetseiten habe ich die untenstehende Kommandodatei geschrieben, die eigentlich nur aus 2 Befehlen besteht.
www.winfaq.de/faq_html/Content/tip1000/onlinefaq.php?h=tip1125.htm
http://www.pcwelt.de/ratgeber/PRN-Dateien-einem-Drucker-zuordnen-1313075.html

Die Kommandodatei print_file.cmd hat folgenden Inhalt:

rem print_file.cmd is a batch file to print PRN files
rem This batch was written by EDV Abmayr, everybody may use it freely.
rem
rem    1) I hope the net use command has created a permanent connection to the printer due to the persistent
rem          parameter. If this should not be the case, remove the remark from the net use line.
rem          The net view line is just a sample how to show the network Freigaben.
rem          ATTENTION: If you have executed the "net use" command as Admin, the copy command fails with msg
rem          "Das System kann die angegebene Datei nicht finden.
rem           0 Datei(en) kopiert."
rem          NOTE: lpt3 is the file he could not find. Windows treats this device as a file in the copy command.
rem          Therefore it makes sense to run the "net use" command in a USER-command shell!
rem          Or run it at each start of this batch file. If the device does already exist, you will get an error
rem          message which can be ignored.
rem          REMARK: The "net use" command only works if the printer is shared (auf Deutsch: freigegeben). So this
rem                  solution only works for shared printers. If you do not want to share the printer in your network,
rem                  you may look for another method to assign it to a printer port (as LPT3). If you have an USB
rem                  printer, you can use that port directly (if you know it) and no "net use" is needed.
rem
rem    2) This batch file is assigned as program to all files with extension .PRN
rem    3) I do not know, whether a file that was created with the settings for a special printer
rem           can be print by another printer, too.
rem    4) This tip is from http://www.winfaq.de/faq_html/Content/tip1000/onlinefaq.php?h=tip1125.htm
rem           It seems to work for old and new Windows versions.
rem    5) The tip with the batch file is from http://www.pcwelt.de/ratgeber/PRN-Dateien-einem-Drucker-zuordnen-1313075.html
rem
rem
rem ------------ ONLY FOR NETWORK PRINTERS: create printer device LPT3 ---
rem    Use the next line (remove "rem") to show the name of the shared printers of computer with name ccc
rem    net view \\BA3
rem
rem    Testing for LPT3 with "IF NOT EXIST LPT3" did not succeed, as he found LPT3 even after "net use LPT3 /delete"

net use LPT3 \\BA3\MFC /persistent:yes

rem
rem ------------ FOR ALL PRINTERS: Copy filte to printer device LPT3 ---

COPY /b c:\t\print_test.prn LPT3

ECHO ERROR %ERRORLEVEL%

IF NOT %ERRORLEVEL%==0 set /p ANYTHING="There was an error. Please check and press ENTER to quit. "


Haftungsausschluß

Wer einen meiner Tips auf seinem Rechner anwendet, tut dies bitte auf eigene Gefahr. Ich übernehme keinerlei Haftung für diese Eingriffe oder deren Folgen.




Das Inhaltsverzeichnis mit Kontakt, Impressum und Copyright finden Sie auf der Hauptseite EDV Abmayr. Letzte Änderung am 21.11.2020