Home
Batch-Programmierung
Contents
1. 91 11 WebLinks 95 11 1 Weblinks 254 8 sa vk SAX Ku 8 8a ba dlc 95 12 Autoren 97 Abbildungsverzeichnis 101 13 Licenses 105 13 1 GNU GENERAL PUBLIC LICENSE 105 13 2 GNU Free Documentation License 106 13 3 GNU Lesser General Public License 107 Kategorie Buch mit Druckversion 1 http de wikibooks org wiki Kategorie 3ABuch 20mit 20Druckversion 1 Allgemeine Information 1 1 Batch Programmierung Batchprogramme h ufig mit Stapelverarbeitungsprogramme oder kurz Stapelpro gramm tibersetzt sind meist kurze Dateien die Befehle der Kommandozeile der Reihe nach abarbeiten Batchprogrammierung erfiillte die grundlegenden Anforde rungen an eine Programmiersprache wie z B if if not und while Da Batch sich in den Bereich Shellscripting einordnen l sst kann man von einer interpreter basierten Skriptsprache reden Das hei t dass die im Editor erstellte Textdatei nicht mit einem Compiler einmal in Maschinensprache bersetzt und in einer ausf hr baren Bin rdatei im x exe Format gespeichert sondern bei jedem Aufruf durch einen Interpreter zur Laufzeit in ein fiir den Computer verst ndliches Format tiber setzt wird Ein Texteditor wie MS Notepad den Windows von Haus aus mitbringt reicht vollkommen aus um Batchprogramme zu schreiben Batchprogrammierung ist speziell fiir die Steuerung des Betriebssystems gedacht fiir die Entwicklung von Anwendungen ist sie nicht geei
2. Neue Seite Hier f ngt meine Batchdatei an Bitte beliebige Taste dr cken Beispiel 2 Inhalt echo off echo Diese Zeile wird angezeigt anstelle von Bitte beliebige Taste dr cken pause gt NUL Ausgabe Diese Zeile wird angezeigt anstelle von Bitte beliebige Taste dr cken Um eine Pause f r eine bestimmte Zeitdauer vorzugeben kann der ping Befehl missbraucht werden Das folgende Beispiel erzeugt eine Pause von etwa 10 Sekunden n mlich 11 minus 1 durch die Ausgabeumleitung gt nul wird jegliche Meldung unterdr ckt ping n 11 localhost gt nul 3 14 PUSHD POPD pushd wechselt zum angegebenen Pfad und speichert den aktuellen Pfad bis zum Aufruf von popd 7 Kapitel 7 1 auf Seite 65 34 REM popd wechselt zum gespeicherten Pfad Die Befehle k nnen geschachtelt werden Syntax pushd pfad popd Beispiel OOGG OA 3 15 WINDOWS gt pushd c temp temp gt pushd c gt popd temp gt popd WINDOWS gt REM REM leitet einen Kommentar ein Die Zeile wird ignoriert beachten Sie jedoch dass RI EM von einem Leerzeichen Tabulator gefolgt werden muss Alternativ dazu werden haufig auch Sprungmarken eingesetzt da hier nur ein statt vier Zeichen ver wendet werden muss H ufig wird jedoch die Sprungmarke zur besseren Ubersicht doppelt hintereinander geschrieben Beispiel REM kill iexplore exe kill iexplore exe kill iexplor
3. Wird eine negative Zahl eingesetzt so gibt ihr Betrag an wieviele Zeichen von rechts genommen werden sollen Dieser Ausdruck liefert daher ebenfalls allo ber die Angabe einer zweiten Zahl kann definiert werden was mit dem Rest nach Auswertung der ersten Zahl entsprechend obiger Regeln geschehen soll W hrend die erste Zahl die Zeichenkette links beschneidet beschneidet die zweite Zahl sie rechts und zwar nach folgenden Regeln set str Hallo set str str 71 2 echo str Eine positive zweite Zahl gibt an wie viele Zeichen ab links vom Rest genommen werden sollen Dieser Ausdruck liefert daher al set str Hallo set str Sstr 71 2 echo str Wird eine negative zweite Zahl eingesetzt so gibt ihr Betrag an wie viele Zei chen vom Rest ab rechts tibergangen werden sollen Dieser Ausdruck liefert daher ebenfalls al M chte man beispielsweise nur einen Teil der Zeichenkette ab links so ist nach diesen Regeln als erste Zahl eine Null anzugeben set str Hallo set str str 70 2 echo str Dieser Ausdruck liefert daher Ha 48 Umgebungsvariablen Mehr zu Stringmanipulation 5 3 Umgebungsvariablen Unter DOS und Windows 9x ME speichern alle Anwendungen und Skripte ihre Umgebungsvariablen in der gleichen Umgebung Unter Windows NT basierten Betriebssystemen ist dies etwas anders Zun chst gibt es einen systemweiten Bereich Dieser enth lt Variablen die fiir alle Ben
4. Worker Se NNR 1 o WreNN a 56 http de wikibooks org w index php title Benutzer Stefan_ wichmann 57 http de wikibooks org w index php title Benutzer StefanTiran 58 http de wikibooks org w index php title Benutzer Sys Bak 59 http de wikibooks org w index php title Benutzer ThePacker 60 http de wikibooks org w index php title Benutzer Theres_no_ global_warming 61 http de wikibooks org w index php title Benutzer Timon Freitag 62 http de wikibooks org w index php title Benutzer Tsch C3 Alfer 63 http de wikibooks org w index php title Benutzer Uwe kausch 64 http de wikibooks org w index php title Benutzer Wei C3 9FNix 65 http de wikibooks org w index php title Benutzer Wolfgangbeyer 66 http de wikibooks org w index php title Benutzer Worker 100 Abbildungsverzeichnis GFDL Gnu Free Documentation License http www gnu org licenses fdl html cc by sa 3 0 Creative Commons Attribution ShareAlike 3 0 License http creativecommons org licenses by sa 3 0 cc by sa 2 5 Creative Commons Attribution ShareAlike 2 5 License http creativecommons org licenses by sa 2 5 cc by sa 2 0 Creative Commons Attribution ShareAlike 2 0 License http creativecommons org licenses by sa 2 0 cc by sa 1 0 Creative Commons Attribution ShareAlike 1 0 License http creat
5. set a n 5 5 10 echo n 10 CMD nimmt folgendes entgegen Auszug aus der Hilfe Gruppierung un re Operatoren arithmetische Operatoren bedeutet Modulo arithmetische Operatoren lt lt gt gt logische Verschiebung amp bitweise UND bitweise exklusives ODER bitweise ODER Zuordnung ee Gos ihe Sag I Il Ss Il oe I Il ll Mit Klammern set a 1 1 4 3 2 2 http de wikibooks org wiki Batch Programmierung _Programmierungshilfen Probleme_mit_Variablen 50 Benutzereingaben 5 5 Benutzereingaben Seit Windows 2000 kann man mit dem set Befehl auch Eingaben abfragen Syntax set p variablenname Angezeigter Text 5 5 1 Beispiel echo off set p var Eingabe echo Sie haben var eingegeben pause Ausgabe Eingabe Test Sie haben Test eingegeben Pause Pr fung ob der Benutzer Text eingegeben hat echo off set p var Eingabe if not defined var echo Bitte geben Sie etwas ein set var nichts REM K nnte auch was ganz anderes sein echo Sie haben Svar eingegeben pause Ausgabe Eingabe leer Bitte geben Sie etwas ein Sie haben nichts eingegeben pause 5 6 Ausgaben in eine Variable umleiten Eine M glichkeit der Umleitung einer Ausgabe besteht ber den set p Befehl Syntax 51 Erweiterungen unter Windows NT ECHO Befehl gt Dateiname SET P Variablenname lt Dateina
6. The Free Software Foundation may publish revised and or new versions of the GNU Lesser General Public License from time to time Such new versions will be similar in spirit to the pre sent version but may differ in detail to address new problems or concerns Each version is given a distinguishing version number If the Li brary as you received it specifies that a certain numbered versi on of the GNU Lesser General Public License or any later ver sion applies to it you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation If the Li brary as you received it does not specify a version number of the GNU Lesser General Public License you may choose any version of the GNU Lesser General Public License ever publis hed by the Free Software Foundation If the Library as you received it specifies that a proxy can deci de whether future versions of the GNU Lesser General Public License shall apply that proxy s public statement of acceptance of any version is permanent authorization for you to choose that version for the Library
7. WAHR springen if SBS true goto WAHR REM keine der Bedingungen ist zu WAHR gesprungen wir sind also im ELSH REM hier waere FALSCH echo Weder A noch B ist TRUE goto eof WAHR echo A oder B ist TRUE F r ein UND wird in den ELSE Zweig gesprungen FALSCH sobald eine der Bedingungen nicht zutrifft Nur wenn alle Bedingunen zutreffen wird der Code ausgef hrt set A true set B false if SAS NEQ true goto FALSCH if SBS NEQ true goto FALSCH REM wird sind durch die IFs gekommen also hat keine der Bedingungen angeschlagen REM hier waere die WAHR Sprungmarke echo A und B sind beide TRUE goto eof FALSCH echo A oder B oder beide sind FALSE Diese beiden Beispiele lassen sich einfach durch Kopieren der IF Zeile um belie big viele Bedingungen erweitern Ein mischen von UND und ODER Verkn pfungen ist leider nicht ohne weiteres m glich 3 13 PAUSE Unterbricht die Abarbeitung der Batchdatei und wartet auf einen Tastendruck Syntax pause Interner Befehl Ab MS DOS bis Windows NT 5 1 XP 33 der in Zweig Batch Befehle Beispiel 1 Inhalt echo off echo Willkommen zur Batchdatei 0 echo echo Die Batchdatei wird auf einer neuen Seite fortgeftihrt pause cls echo Hier f ngt meine Batchdatei an pause Ausgabe Willkommen zur Batchdatei beispiel bat Die Batchdatei wird auf einer neuen Seite fortgeftihrt Bitte beliebige Taste dr cken
8. diskperf n ipconfig flushdns Einfach den Text kopieren in eine Textdadei und zur bat machen 88 9 Zusatz Tools Viele Aufgaben sind mit der Batchprogrammierung bzw mit Windows Scripting alleine kaum oder nur sehr umst ndlich zu l sen So kann das Umwandeln von Da teien Textersetzungen aufgrund der nicht ganz sauberen Behandlung von Sonder bzw Operationszeichen zur Qual werden Erstaunlich fiir ein Betriebssystem wel ches seit nun mehr tiber 0 Jahren mit Windows 95 diese Restriktionen offiziell beseitigt hat Oft k nnen dafiir OpenSource Tools wie SFK Swiss File Knive und Sed sehr erfolgreich in die Batch Programmierung eingebunden werden Fiir das Ver packen und Komprimieren von Dateien l sst sich das freie 7 Zip gut ber die Kommandozeile steuern Das GPL Programm Gnuplot eignet sich hervorragend f r die Visualisierung von Daten im CSV Format und l sst sich einfacher und schneller scripten als MS Excel oder OO org Calc Zum Herunterladen von Dateien und Webseiten kann Wget verwendet werden Auch f r Batch Dateien gibt es diverse kostenlose Batch Compiler die die Datei in eine ausf hrbare exe Datei umwandeln und den Code vor Manipulation und oder Copyright Verletzungen sch tzen F r gehobenere Scripting Anspr che und komplexere Vorhaben mit einer l ngeren Lebensdauer sollten dezidierte Scripting Sprachen z B Awk Perl Python Ruby oder Tcl in Erw gung gezogen werden f r die gl cklicherweise das GN
9. if it has fewer than five unless they release you from this requirement C State on the Title page the name of the pu blisher of the Modified Version as the publisher D Preserve all the copyright notices of the Document E Add an appro priate copyright notice for your modifications adjacent to the other copyright notices F Include immediately after the co pyright notices a license notice giving the public permission to use the Modified Version under the terms of this License in the form shown in the Addendum below G Preserve in that licen se notice the full lists of Invariant Sections and required Cover Texts given in the Document s license notice H Include an unaltered copy of this License I Preserve the section Entit led History Preserve its Title and add to it an item stating at least the title year new authors and publisher of the Modified Version as given on the Title Page If there is no section Entit led Historyin the Document create one stating the title year authors and publisher of the Document as given on its Title Page then add an item describing the Modified Version as sta ted in the previous sentence J Preserve the network location if any given in the Document for public access to a Transpa rent copy of the Document and likewise the network locations given in the Document for previous versions it was based on These may be placed in the HistoryBection You may omit a network lo
10. this License An entity transaction is a transaction transferring control of an organization or substantially all assets of one or subdivi ding an organization or merging organizations If propagation of a covered work results from an entity transaction each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party s predecessor in interest had or could give under the previous paragraph plus a right to possession of the Corresponding Source of the work from the predecessor in interest if the predecessor has it or can get it with reasonable efforts You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License For example you may not impose a license fee royalty or other charge for exercise of rights granted under this License and you may not initiate litigation including a cross claim or counterclaim in a lawsuit alleging that any patent claim is infringed by making using selling offering for sale or importing the Program or any portion of it 11 Patents A contributor is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based The work thus licensed is called the contributor s cont ributor version A contributor s essential patent claims are all patent claims owned or controlled by the contributor whether already acqui red o
11. to assure everyone the effective freedom to copy and re distribute it with or without modifying it either commercially or noncommercially Secondarily this License preserves for the author and publisher a way to get credit for their work while not being considered responsible for modifications made by others This License is a kind of copyleft which means that derivati ve works of the document must themselves be free in the same sense It complements the GNU General Public License which is a copyleft license designed for free software We have designed this License in order to use it for manuals for free software because free software needs free documentation a free program should come with manuals providing the same freedoms that the software does But this License is not limited to software manuals it can be used for any textual work re gardless of subject matter or whether it is published as a printed book We recommend this License principally for works whose purpose is instruction or reference 1 APPLICABILITY AND DEFINITIONS This License applies to any manual or other work in any medi um that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License Such a no tice grants a world wide royalty free license unlimited in du ration to use that work under the conditions stated herein The Document below refers to any such manual or work Any member of the public is
12. Datei anzuh ngen ispi it more eins tx So kann man zum Beispiel mit MEN txt gt gt D zwei txt den Inhalt der eins txt an den Inhalt der zwei txt anh ngen eins txt wird dabei nicht ver ndert 12 move 2 23 move Verschieben von einer oder mehrerer Dateien von einem Verzeichnis in ein anderes oder ein Verzeichnis umbenennen move test test_neu 2 24 netsh Ohne Parametereingabe ergibt sich ein neuer Kontext Weitere Hilfe mit Beispiel netsh interface dump gt ipconf1 dat Diese Zeile als Batch Datei ausgefiihrt legt die momentane IP Konfiguration in einer Datei namens ipconfl dat ab Umgekehrt kann aus einer Datei z B namens ipconf2 dat eine neue IP Konfiguration geladen und bernommen werden netsh f ipconf2 dat So l sst sich eine IP Konfiguration ohne Umherklicken in Systemmeniis ablegen und modifiziert wieder zuriickholen 2 25 path Durch die Angabe eines Pfades wird das Betriebssystem auf der Kommandozeile dazu aufgefordert neben dem aktuellen Verzeichnis auch in weiteren Verzeich nissen zu suchen Wird der Befehl ohne Parameter ausgefiihrt so werden alle aktuellen Pfade ausgegeben 2 26 prompt Legt das Aussehen der Eingabezeile fest 2 27 rd rmdir Der Befehl rd oder rmdir remove directory l scht ein Verzeichnis wenn dieses leer ist Parameter 13 Wichtige DOS Kommandos e s L scht einen ganzen Verzeichnisbaum mit Dateien e q
13. EPSON rem druckerbeschreibung damit der Drucker leichter identifiziert werden kann set drucker EPSONNT rem drucker das muss der Freigabename im Netzwerk auf dem Freigaberechner sein if 1 drucker01 goto drucker01l if 1 drucker02 goto drucker02 if 1 canon goto canon goto datei drucker02 set server 42 1 1 240 set druckerbeschreibung HP DJ 755CM im Sekretariat set drucker hpd3755 tcp shift goto datei Canon set server 192 168 0 1 set druckerbeschreibung Canon s w Laser im EG set drucker CanonLBP shift goto datei datei if 1 goto aufruf goto plot splot echo echo Dateiname 3 51 echo Druckserver server echo Freigabename drucker echo Beschreibung druckerbeschreibung echo print d server drucker 1 goto eof aufruf echo echo aufruf pl plotter Datei echo plotter drucker01 drucker02 canon voreingestellt ist drucker0l echo Anmerkung zur Nutzung dieses Scriptes 79 Beispiele Der Printbefehl schickt die Datei OHNE Interpretation direkt an den Drucker Eine Bilddatei im JPEG Format wiirde statt der Grafik also lediglich einen haufen wirrer Zeichen ergeben Der Drucker muss in der Lage sein selbst ASCH Zeichen zu verarbeiten und aus zu geben Dies ist bei lteren Druckern vor ca 1996 sicher immer der Fall Heute beherrschen meist nur noch PostScript fahige Drucker diese Fahigkeit Billigen GDI Druckern muss man etwas auf d
14. Mit dem Batchbefehl goto wird eine Sprungmarke s o angesprungen Syntax goto NAMEDERSPRUNGMARKE Beispiel Siehe unter Doppelpunkt 3 12 IF Der IF Befehl erm glicht eine einfache Verzweigung und wird oft zusammen mit dem GOTO Befehl eingesetzt IF erm glicht hierbei sowohl die Pr fung auf eine Gleichheit als auch auf das Vorhandensein von Dateien Beispiel 1 echo off IF exist c temp my log echo gt c temp my log echo Log Datei erstellt gt gt c temp my log Beispiel 1 pr ft ob eine Logdatei vorhanden ist und erstellt ggf eine Neue Beispiel 2 echo off IF SCOMPUTERNAMES Bastie GOTO WAHR REM hier landet man wenn der if Ausdruck falsch ist 5 Kapitel 3 3 auf Seite 18 6 Kapitel 3 11 auf Seite 30 30 IF GOTO WEITER WAHR REM hier landet man wenn der if Ausdruck wahr ist echo Willkommen Zuhause REM Jetzt wird der if Zweig verlassen GOTO WEITER WEITER echo Have a nice Day Beispiel 3 I SCOMPUTERNAMES Bastie echo Willkommen zu Hause ELSE echo Du bist auf Computer SCOMPUTERNAMES echo Sch nen Tag noch Beachten Sie bei der Pr fung von Umgebungsvariablen niemals IF Umgebungsvariable Pr fwert zu schreiben wenn die Umgebungsvariable nicht gesetzt ist Sie erhalten sonst einen Syntaxfehler Der Parameter i unterbindet eine Differenzierung der Gro Kleinbuchstaben ACHTUNG Bei d
15. Mit dieser Batchdatei findet man heraus welche Windowsversion verwendet wird Das ist niitzlich wenn man mit bestimmten Pfaden arbeitet die je nach Betriebs system verschieden sind Hier wird das Ergebnis mithilfe einer VBScript MsgBox ausgegeben echo off VER find i Windows 95 gt NUL IF NOT ERRORLEVEL 1 GOTO 9598ME VER find i Windows 98 gt NUL IF NOT ERRORLEVEL 1 GOTO 9598ME VER find i Windows Millennium gt NUL IF NOT ERRORLEVEL 1 GOTO 9598ME VER find XP gt nul IF Serrorlevel EQU 0 GOTO XP VER find 2000 gt mul 86 NET IF Serrorlevel EQU 0 GOTO 2000 VER find NT gt nul IF Serrorlevel EQU 0 GOTO NT VER find Microsoft Windows Version 6 1 gt nul IF errorlevel EQU 0 GOTO Sieben VER find Microsoft Windows Version 6 gt nul IF Serrorlevel EQU 0 GOTO Vista VER find Microsoft Windows Version 5 gt nul IF Serrorlevel EQU 0 GOTO 2003 goto unknown goto end unknown echo MsgBox Betriebssystem unbekannt VbInformation VbOKOnly Ihr Betriebssystem gt STEMPSlos vbs goto end 9598ME echo MsgBox Sie haben 95 98 oder ME VbInformation VbOKOnly Ihr Betriebssystem gt STEMPSlos vbs goto end NT echo MsgBox Sie haben Windows NT VbInformation VbOKOnly Ihr Betriebssystem gt STEMPSlos vbs goto end 2003 echo MsgBox Sie haben Windows 2003 VbInformation VbOKOnly Ihr Betriebssystem gt STEMPSlos vbs goto end
16. a further restriction but permits relicensing or conveying under this License you may add to a covered work material governed by the terms of that license document provi ded that the further restriction does not survive such relicensing or conveying If you add terms to a covered work in accord with this section you must place in the relevant source files a statement of the additional terms that apply to those files or a notice indicating where to find the applicable terms Additional terms permissive or non permissive may be stated in the form of a separately written license or stated as excepti ons the above requirements apply either way 8 Termination You may not propagate or modify a covered work except as ex pressly provided under this License Any attempt otherwise to propagate or modify it is void and will automatically termina te your rights under this License including any patent licenses granted under the third paragraph of section 11 However if you cease all violation of this License then your license from a particular copyright holder is reinstated a pro visionally unless and until the copyright holder explicitly and finally terminates your license and b permanently if the co pyright holder fails to notify you of the violation by some rea sonable means prior to 60 days after the cessation Moreover your license from a particular copyright holder is re instated permanently if the copyri
17. a licensee and is addressed as you You accept the license if you copy modify or distribute the work in a way requiring permission under copyright law A Modified Version f the Document means any work contai ning the Document or a portion of it either copied verbatim or with modifications and or translated into another language A SSecondary Sectionis a named appendix or a front matter section of the Document that deals exclusively with the rela tionship of the publishers or authors of the Document to the Document s overall subject or to related matters and conta ins nothing that could fall directly within that overall subject Thus if the Document is in part a textbook of mathematics a Secondary Section may not explain any mathematics The re lationship could be a matter of historical connection with the subject or with related matters or of legal commercial philo sophical ethical or political position regarding them The Invariant Sections re certain Secondary Sections whose tit les are designated as being those of Invariant Sections in the notice that says that the Document is released under this Licen se If a section does not fit the above definition of Secondary then it is not allowed to be designated as Invariant The Docu ment may contain zero Invariant Sections If the Document does not identify any Invariant Sections then there are none The Cover Texts re certain short passages of text that are lis te
18. berschriften ausgeblendet Der Befehl tasklist ist erst ab Windows XP verf gbar 2 34 time Gibt die aktuelle Zeit aus und erm glicht dem Benutzer die nderung der Uhrzeit Wird der Befehl mit dem Parameter t aufgerufen so wird nur die aktuelle Zeit ausgegeben time kann auch als Variable benutzt werden so kann man zum Beispiel mit time 0 5 die ersten 5 Zeichen bernehmen Beispiele C gt time Aktuelle Zeit 10 03 04 63 Geben Sie die neue Zeit ein c gt echo time 10 03 04 63 c gt echo time 0 5 10 03 Bei einigen Betriebssystemversionen erfordert das ndern der Systemzeit admi nistrative Rechte 2 35 title Dieser Befehl ndert die Fenster berschrift des Programmfensters title Beispiel 3 Kapitel 2 34 auf Seite 15 15 Wichtige DOS Kommandos 2 36 type Gibt den reinen Text Inhalt der angegebenen Datei z B bat cmd oder txt aus 2 37 Color Gibt die Farbe an Farbattribute werden durch ZWEI hexadezimale Ziffern angegeben die erste bezieht sich auf den Hintergrund die zweite auf den Vordergrund Jede Ziffer kann einen der folgenden Werte annehmen 0 Schwarz 8 Dunkelgrau 1 Dunkelblau 9 Blau 2 Dunkelgrin A Gr n 3 Blaugr n B Zyan 4 Dunkelrot C Rot 5 Lila D Magenta 6 Ocker E Gelb 7 Hellgrau F Wei 16 3 Batch Befehle 3 1 Vorsicht Leerzeichen Fehlplazierte oder fehlende Leerze
19. cd PFAD wieder ins Startverzeich nis wechseln 2 5 chcp Anzeige der aktuellen CodePage oder Setzen einer neuen CodePage change codepage chcp nnn Beispiele f r nnn e 437 Die urspr ngliche Zeichensatztabelle des IBM PC e 720 Arabisches Alphabet e 737 Griechisches Alphabet e 850 westeurop ische Sprachen DOS Latin 1 e 857 T rkisches Alphabet Wichtige DOS Kommandos e 866 Kyrillisches Alphabet 2 6 cls L scht den Bildschirminhalt clear screen 2 7 comp oder fc Vergleicht den Inhalt zweier Dateien und stellt die Unterschiede dar compare file compare 2 8 x copy robocopy Mit dem Befehl copy k nnen eine Datei oder mehrere Dateien kopiert werden xcopy ist die erweiterte Version von copy die mehr Optionen bietet Diese ist nicht in allen Windows Versionen verfiigbar Das weitaus m chtigere robocopy ist ab Vista standardm ig wieder verf gbar bei Windows XP und 2000 fehlt dieses Programm zun chst Microsoft stellt ro bocopy aber im Windows Server 2003 Resource Kit Tools 2003 auch f r diese Betriebssystemversionen bereit Mit dem Befehl copy b DATEI DATEI NEUE DATEI kann man Dateien zusammenf gen 2 9 date Gibt das aktuelle Datum aus und erm glicht dem Benutzer die nderung des Datums Wird der Befehl mit dem Parameter t aufgerufen so wird nur das aktuelle Datum ausgegeben Um das Datum zu teilen also z B nur das Jahr zu verwenden
20. html 16 http www administrator de Workshop_Batch_for_Runaways_ _ Part_III_ _Datums _und_Zeitvariablen_im_Batch html 17 http www administrator de Tutorial_zur_FOR Schleife html 18 http www administrator de Wie_Arbeite_ich_mit_Batch UmgebungsVariablen 3F_Erstellung_Umgang_Erweiterungen_Ver C3 A4nderungen html 19 http technet microsoft com en us library cc754340 aspx 20 http technet microsoft com en us library cc722159 aspx 21 http technet microsoft com de de library cc785423 aspx 22 http technet microsoft com en us library bb490890 aspx 96 12 Autoren Edits User 2 Alizdair 1 AquariaNR 2 Autor 2 Aza l 7 Bastie 13 Batchscripter93 2 Blingnue 1 Boern99 10 Codejunkie 1 CorneliusWasmund 1 Creibens 7 Daniel B 1 Der Leo 20 Dirk Huenniger 1 DonQuichot gt 1 http de wikibooks org w index php title Benutzer Alizdair 2 http de wikibooks org w index php title Benutzer AquariaNR 3 http de wikibooks org w index php title Benutzer Autor 4 http de wikibooks org w index php title Benutzer Aza C3 ABl 5 http de wikibooks org w index php title Benutzer Bastie 6 http de wikibooks org w index php title Benutzer Batchscripter93 7 http de wikibooks org w index php title Benutzer Blingnue 8 http de wikibooks org w index php title Benutzer Boern99 9 http de wikibooks org w index php title Benutzer Codejunki 10 http de wikibooks org w index php title Benutzer CorneliusWasmu
21. mainloop pinge den Host 1 mal und leite die Ausgabe nach nul um keine sichtbare Ausgabe ping 1 n 1 gt nul speichere den Errorlevel in die Variable status set status s errorlevelS sende eine Nachricht sobald der remote Host online ist o if Sstatuss 0 msg Susernames 1 online amp amp exit 0 minimalistische Fortschrittsanzeige Set P i lt NUL sleep workaround wer eine bessere einfachere genauere amp universellere M glichkeit kennt bitte korrigieren pinge den lokalen Computer 10 mal ping localhost n 10 gt nul gehe zur ck zum anfang goto mainloop Syntax echo 82 NET echo Syntax n0 Hostname oder IP echo echo mping echo echo Pingt einen offline Host und gibt eine Meldung echo aus sobald er wieder online ist echo 8 0 14 Defrag mit Endlos Schleife Das eingebaute Defrag Tool erlaubt ja immer nur die gleichzeitige Defragmentie rung eines Laufwerks AuBerdem sind oftmals mehrere Durchg nge n tig bis das Laufwerk wirklich vollst ndig defragmentiert ist Mit dieser kleinen Batch Datei werden alle Partitionen immer wieder hintereinander defragmentiert Wenn man wieder arbeiten will kann man einfach das Eingabefenster schlieBen Auch bei laufendem defrag passiert dabei nichts weil defrag im Hintergrund die aktuelle Arbeit sauber beendet Damit aber nicht defekte Laufwerke einfach blind defragmentiert werden habe ich eine etwas aufwendige Prozedur eingebaut die die L
22. mal anhand von Beispielen erkl ren Das Problem set test 1 if Steste 1 set test 2 echo Wert von test im IF Block test echo Wert von test nach IF Block Stest Man sollte meinen dass der Wert von test in beiden Ausgaben 2 ist Doch leider ist es nicht so Denn innerhalb des IF Blocks wird das Neusetzen der Variable test von 1 auf 2 noch nicht aktiv und somit ist das Ergebnis Wert von test im IF Block 1 Erst nach dem IF Block ist der Wert aktualisiert Wert von test nach IF Block 2 L sung cmd exe V In einer Batchdatei die mit cmd V gestartet wurde werden Variablen innerhalb von Befehlsbl cken aktualisiert Jedoch kann man sie nicht gewohnt mit test ansprechen sondern mit test echo off if g rzzen start WAIT B cmd exe V C 70 machen goto eof set test 1 if Stests 1 set test 2 echo Wert von test Prozent in dem IF Block test echo Wert von test Ausrufezeichen in dem IF Block test echo Wert von test nach dem IF Block test 61 Programmierungshilfen pause 6 0 13 Ausgaben Fehler unterdr cken Manchmal m chte man per Batch ein Programm starten aber es soll dabei keine Ausgabe gemacht werden Das ist recht einfach MeinProgramm exe gt NUL Es k nnte aber sein dass evtl Fehler dennoch ausgegeben werden Das liegt daran da die Programme in dem Fall auf stderr statt stdout schreiben Um auch in dem Fall die Ausgabe zu unterdr cken ka
23. modify a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission other than the making of an exact copy The resulting work is called a modified version of the earlier work or a work based on the earlier work A covered work means either the unmodified Program or a work based on the Program To propagate a work means to do anything with it that wi thout permission would make you directly or secondarily liable for infringement under applicable copyright law except execu ting it on a computer or modifying a private copy Propagation includes copying distribution with or without modification making available to the public and in some countries other ac tivities as well To convey a work means any kind of propagation that enables other parties to make or receive copies Mere interaction with a user through a computer network with no transfer of a copy is not conveying An interactive user interface displays Appropriate Legal Noti ces to the extent that it includes a convenient and prominently visible feature that 1 displays an appropriate copyright notice and 2 tells the user that there is no warranty for the work ex cept to the extent that warranties are provided that licensees may convey the work under this License and how to view a copy of this License If the interface presents a list of user com mands or options such as a menu a
24. so This is fundamentally incompatible with the aim of protecting users freedom to change the software The systematic pattern of such abuse occurs in the area of pro ducts for individuals to use which is precisely where it is most unacceptable Therefore we have designed this version of the GPL to prohibit the practice for those products If such pro blems arise substantially in other domains we stand ready to extend this provision to those domains in future versions of the GPL as needed to protect the freedom of users Finally every program is threatened constantly by software pa tents States should not allow patents to restrict development and use of software on general purpose computers but in those that do we wish to avoid the special danger that patents app lied to a free program could make it effectively proprietary To prevent this the GPL assures that patents cannot be used to ren der the program non free The precise terms and conditions for copying distribution and modification follow TERMS AND CONDITIONS 0 Definiti ons This License refers to version 3 of the GNU General Public License Copyright also means copyright like laws that apply to other kinds of works such as semiconductor masks The Program refers to any copyrightable work licensed under this License Each licensee is addressed as you Licensees and recipients may be individuals or organizations To
25. springt automatisch zum Ende der Batchdatei beendet die aktuelle Prozedur 20 CLS 3 5 CLS Mit cls clear screen wird der Bildschirm gel scht Syntax cls Interner Befehl Ab MS DOS bis Windows 7 Beispiel Inhalt echo off echo Hier schreibe ich jetzt ganz viel Text echo Hier kann ich z B hinschreiben dass ich jemanden mag echo echo Aber den Text sieht man gleich sowieso nicht mehr Hihi cls echo War irgendetwas pause gt nul Ausgabe War irgendetwas 3 6 CMD Das Programm das es m glich macht DOS Befehle auf einem NT System zu benutzen CMD ist die NT Entsprechung von COMMAND gt Syntax cmd al ul ql dl e ON OFF ON OFF v ON OFF c befehl s k y Konsole Ab Windows NT 4 0 bis Windows NT 6 1 Windows 7 Beispiel Inhalt cmd Ausgabe unter XP 3 Kapitel 3 8 auf Seite 23 21 Batch Befehle C gt cmd Microsoft Windows XP Version 5 1 2600 C Copyright 1985 2001 Microsoft Corp C gt Ausgabe unter Vista C gt cmd Microsoft Windows Version 6 0 6001 Copyright c 2006 Microsoft Corporation C gt Ausgabe unter Win 7 C gt cmd Microsoft Windows Version 6 1 7600 Copyright c 2009 Microsoft Corporation CNS Ausgabe unter Win 8 Beta C gt cmd Microsoft Windows Version 6 2 8250 Copyright c 2012 Microsoft Corporation E gt 3 7 COLOR Alle Rechte vorbehalten Alle Rechte vorbehalten Alle Rechte vorb
26. translations requires special permission from their copyright holders but you may include translations of some or all Invariant Sections in additi on to the original versions of these Invariant Sections You may include a translation of this License and all the license notices in the Document and any Warranty Disclaimers provided that you also include the original English version of this License and the original versions of those notices and disclaimers In case of a disagreement between the translation and the original version of this License or a notice or disclaimer the original version will prevail If a section in the Document is Entitled Acknowledgements Dedications or History the requirement section 4 to Pre serve its Title section 1 will typically require changing the actual title 9 TERMINATION You may not copy modify sublicense or distribute the Docu ment except as expressly provided under this License Any at tempt otherwise to copy modify sublicense or distribute it is void and will automatically terminate your rights under this Li cense However if you cease all violation of this License then your license from a particular copyright holder is reinstated a pro visionally unless and until the copyright holder explicitly and finally terminates your license and b permanently if the co pyright holder fails to notify you of the violation by some rea sonable means prior to 60 days after the cessat
27. ware and charge for them if you wish that you receive source code or can get it if you want it that you can change the soft ware or use pieces of it in new free programs and that you know you can do these things To protect your rights we need to prevent others from denying you these rights or asking you to surrender the rights Therefo re you have certain responsibilities if you distribute copies of the software or if you modify it responsibilities to respect the freedom of others For example if you distribute copies of such a program whe ther gratis or for a fee you must pass on to the recipients the same freedoms that you received You must make sure that they too receive or can get the source code And you must show them these terms so they know their rights Developers that use the GNU GPL protect your rights with two steps 1 assert copyright on the software and 2 offer you this License giving you legal permission to copy distribute and or modify it For the developers and authors protection the GPL clearly ex plains that there is no warranty for this free software For both users and authors sake the GPL requires that modified versi ons be marked as changed so that their problems will not be attributed erroneously to authors of previous versions Some devices are designed to deny users access to install or run modified versions of the software inside them although the ma nufacturer can do
28. 2000 echo MsgBox Sie haben Windows 2000 VbInformation VbOKOnly Ihr Betriebssystem gt STEMPSlos vbs goto end XP echo MsgBox Sie haben Windows XP VbInformation VbOKOnly Ihr Betriebssystem gt STEMPSlos vbs goto end Vista echo MsgBox Sie haben Windows Vista oder Windows 7 RC VbInformation VbOKOnly Ihr Betriebssystem gt TEMP os vbs goto end Sieben echo MsgBox Sie haben Windows 7 VbInformation VbOKOnly Ihr Betriebssystem gt STEMP os vbs goto end send START TEMP os vbs 87 Beispiele 8 0 19 TEMP Verzeichnis l schen Im TEMP Verzeichnis sammeln sich mit der Zeit viele Dateien und Unterver zeichnisse an Mit diesem Skript werden alle auf einmal gel scht echo off call clean STEMPS IF NOT STEMPS SITMPS Call clean STMPS pause goto eof Clean del q S 1x x FOR D D IN 1 x DO rmdir s q D goto eof Wahrscheinlich erh lt man ein paar Fehler wenn z B Dateien ge ffnet sind Neue Version Eine Version fiir Win XP 2000 WinVista Win7 Echo off del f s q HOMEPATH Lokale Einstellungen Temp x x del f s q HOMEPATH Lokale Einstellungen Temporary Internet Files del f s q HOMEPATH Lokale Einstellungen Verlauf del f s q windir Temp x del f s q 3windir Prefetch x x del f s q Swindir Temp rmdir s q SHOMEPATH S Lokale Einstellungen Temp rmdir s q Swindir Prefetch
29. 45 3 139 ms 35 ms 36 ms bbcrOl ams titannetworks nl 217 173 143 417 4 40 ms x 43 ms xsr03 asd002a surf net 195 69 144 34 5 41 ms 34 ms 35 ms AZ 500 XSR01 AmsterdamlA surf net 145 145 80 21 6 39 ms 38 ms 37 ms KNCSW001 router Customer surf net 145 145 18 158 7 41 ms 43 ms 37 ms gi0 24 csw2 knams wikimedia org 145 97 32 29 8 38 ms 38 ms 36 ms rr knams wikimedia org 145 97 39 155 Ablaufverfolgung beendet C gt 68 netstat 7 4 netstat Dieser Befehl zeigt alle offenen TCP IP ICMP UDP usw Verbindungen an netstat Mit der Erweiterung p Protokoll lassen sich auch nur Verbindungen zum Entsprechenden Protokoll auslesen meist TCP netstat p TCP 7 5 NET NET ist ein Tool zur Uberwachung und Manipulation von Netzwerkaktivit ten sowie Windows Diensten Es hat einen recht groBen Funktionsumfang von dem ich hier jedoch nur einige kurz vorstelle 7 5 1 NET USE Netzlaufwerke verbinden NET USE kann genutzt werden um eine Verbindung zu Netzwerk oder Samba Freigaben herzustellen Ublicherweise wird hierbei ein Laufwerksbuchstabe ver wendet dies ist jedoch nicht zwingend Syntax NET USE x name oder ip des rechners freigabe Wenn fiir die Verbindung die Eingabe von Zugangsdaten erforderlich ist k nnen diese auch mit angegeben werden NET USE x USER benutzer name oder ip des rechners freigabe passwort Wenn fiir einen Rechner Zugangsdaten be
30. 9 53 Uhr Hierbei steht 0 8 f r die Angabe der Stellen Mit 0 8 wird angegeben dass die Ausgabe der Zeit bei Position 0 beginnen soll und insgesamt 8 Stellen beinhalten soll Die maximale Stellenanzahl ist 11 0 11 Beim Datum ist diese Angabe hier nicht n tig da dieses standardm ig im dd mm yyyy Format ausgegeben wird Wer aber nur das Jahr haben will kann Sodate 4 eingeben und erh lt damit die letzten 4 Zeichen F r ein sortierge rechtes Datum in der Umgebungsvariablen sortdate sorgt z B set SORTDATE date 4 Sdate 3 2 Sdate 0 2 echo SSORTDATES Wert der Umgebungsvariable 2009 04 20 Beachte In einer Batchdatei kann die Verwendung von DATE und insbesondere von TIME dazu f hren da sich die ausgegebene Uhrzeit nicht aktualisiert Hierzu folgendes Beispiel echo off echo Die aktuelle Zeit ist STIMES echo bitte ca 5 Sec warten ping n 5 localhost gt NUL echo jetzt sollten ca 5 Sec vergangen sein TIME liefert TIME das ist noch OK echo doch in der FOR Schleife wird bereits die alte Zeit verwendet for L N IN 0 1 3 DO echo time pause echo und dies bleibt f r jede Ausgabe innerhalb der FOR Schleife so echo echo Auch in z amp nbsp B IF Schleifen ist das so 54 Ausgaben in eine Variable umleiten if TRUE TRUE echo 1 Zeit in der If Schleife STIMES echo Warte ca 5 Sec ping n 5 localhost gt NUL echo 2
31. Batch Programmierung Wikibooks org 21 Juni 2012 On the 28th of April 2012 the contents of the English as well as German Wikibooks and Wikipedia projects were licensed under Creative Commons Attribution ShareAlike 3 0 Unported license An URI to this license is given in the list of figures on page 101 If this document is a derived work from the contents of one of these projects and the content was still licensed by the project under this license at the time of derivation this document has to be licensed under the same a similar or a compatible license as stated in section 4b of the license The list of contributors is included in chapter Contributors on page 97 The licenses GPL LGPL and GFDL are included in chapter Licenses on page 105 since this book and or parts of it may or may not be licensed under one or more of these licenses and thus require inclusion of these licenses The licenses of the figures are given in the list of figures on page 101 This PDF was generated by the IAIEX typesetting software The KIEX source code is included as an attachment source 7z txt in this PDF file To extract the source from the PDF file we recommend the use of http www pdflabs com tools pdftk the pdf toolkit utility or clicking the paper clip attachment symbol on the lower left of your PDF Viewer selecting Save Attachment After extracting it from the PDF file you have to rename it to source 7z To uncompress the resulting archive we recommend
32. Bedingung berpr ft und erf llt bzw nicht erf llt wird und entsprechend weiter verfahren werden soll Mit dem Batchbefehl goto wird die Sprungmarke angesprungen Anmerkung Der Doppelpunkt hat auch die Funktion der Manipulation von Variablen wenn er direkt hinter einer Variablen steht Siehe Kapitel Variablen in dieser Publikation Syntax NAMEDERSPRUNGMARKE Sprungmarken eine beliebige L nge haben unter MS DOS und lteren Windows Versionen werden allerdings nur die ersten 8 Zeichen beachtet der Rest wird ignoriert Kommen in einer Batch also Sprungmarkel und Sprungmarke2 vor so wird unter Umst nden nur die erste beim Aufruf einer der Beiden gefunden Also besser ziell oder 1st schreiben Gro und Kleinschreibung wird nicht unterschieden Beispiel Inhalt 1 Kapitel 3 3 auf Seite 18 2 Kapitel 3 15 auf Seite 35 18 CALL if exist C blabla txt goto EDITBLA goto END Kommentarzeile sofern es erforderlich ist einen Kommentar zu schreiben Zur Unterscheidung von Sprungmarken verwende ich zwei EDITBLA edit c blabla txt END Sofern die Datei C blabla txt existiert wird sie mit edit ge ffnet sonst wird das Unterprogramm bersprungen und die Batchdatei bei der Marke END fortgesetzt also beendet Seit die Befehlserweiterungen aktiviert sind steht in Batchdateien die Sprungmarke EOF zur Verf gung welche sich unsichtbar am Ende der Batch Datei befindet 3 4 CALL Mit ca
33. Corresponding Source Regardless of what server hosts the Corresponding Source you remain obliga ted to ensure that it is available for as long as needed to satisfy these requirements e Convey the object code using peer to peer transmission provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d A separable portion of the object code whose source code is excluded from the Corresponding Source as a System Library need not be included in conveying the object code work A User Product is either 1 a consumer product which me ans any tangible personal property which is normally used for personal family or household purposes or 2 anything desi gned or sold for incorporation into a dwelling In determining whether a product is a consumer product doubtful cases shall be resolved in favor of coverage For a particular product recei ved by a particular user normally used refers to a typical or common use of that class of product regardless of the status of the particular user or of the way in which the particular user ac tually uses or expects or is expected to use the product A pro duct is a consumer product regardless of whether the product has substantial commercial industrial or non consumer uses unless such uses represent the only significant mode of use of the product Installation Inform
34. Dienste echo call M helpsvc Hilfe und Support call M ImapiService IMAPI CD Brenn COM Dienste echo echo nicht ben tigte Dienste Deaktivieren echo call D cisvc Indexdienst call D ERSvc Fehlerberichterstattungsdienst echo echo Automatische Dienste echo call A CryptSvc Kryptografiedienste call A MSIServer Windows Installer 76 NET echo echo echo Fertig echo pause goto eof A echo 2 auf Automatisch set Parameter auto net start 1 goto machen M echo 2 auf Manuell set Parameter demand net stop 1 goto machen D echo 2 auf Deaktiviert set Parameter disabled net stop 1 goto machen rem Systemstart rem system rem auto rem demand rem disabled Ger tetreiber der vom Startladeprogramm geladen wird Ger tetreiber start w hrend der Kernelinitialisierung automatischer start nach systemstart vor Benutzeranmeldung Dienst der manuell gestartet werden muss Dienst deaktivieren sc config 1 start Parameter machen echo on echo off echo echo goto eof 8 0 10 Windows XP SP2 installierte Patches Updates auflisten Zeigt unter Windows XP mit Service Pack 2 alle zus tzlich installierten Patches Up dates an echo off set RegHotfixListe HKEY_ LOCAL_MACHINE SOFTWARE Microsoft Windows NT CurrentVersion Hotfix set RegHotfixInfo HKEY_LOCAL_MACHINE SOFTWARE Microsoft Updates Windows XP SP3 77 Beispiele for F del
35. ET START ohne Parameter zeigt die aktuell gestarteten Windows Dienste an 70 NET 7 5 4 NET STOP Stoppt Windows Dienste Gleiche Syntax wie NET START 7 5 5 NET VIEW Zeigt erreichbare Computer des lokalen Netzwerks bzw deren Freigaben an Syntax NET VIEW computername Einfache Eingabe von NET VIEW zeigt alle Computer an wenn ein Computername mit angegeben wird werden die Freigaben angezeigt Dies funktioniert nur bei Windows Rechnern UNIX Rechner mit Samba Freigaben werden zwar in der Ubersicht angezeigt die Freigaben k nnen aber nicht abgefragt werden 7 5 6 NET USER Mit diesem Befehl k nnen Benutzerkonten verwaltet werden Dazu sind Adminis tratorrechte erforderlich Syntax NET USER Dieser Befehl allein zeigt nur alle Benutzer des Rechners an 2000 XP Net User lt name gt Durch diesen Befehl wird die Einstellung des Benutzerkontos des Benutzers lt name gt angezeigt 2000 XP Net User lt name gt lt passwort gt add 71 Netzwerkumgebung Dieser Befehl fiigt einen Benutzer hinzu 2000 XP Net User lt name gt delete Und dieser Befehl wiederum l scht einen Benutzer 2000 XP Net User lt name gt lt passwort gt Dieser Befehl ver ndert das Passwort des Benutzers Wenn anstatt des passworts ein Stern angegeben wird dann wird das neue Passwort abgefragt 2000 XP Net User lt nam
36. F i IN BEFEHL DO set BefehlOutput i Oder mit usebackq Option FOR F usebackq i IN BEFEHL DO set BefehlOutput i Die Zeichenkette zwischen den einfachen Anf hrungszeichen wird dabei als Be fehlszeile betrachtet und von einer untergeordneten CMD EXE ausgef hrt Be fehlOutput Kann nun beliebig gebraucht werden Beispiel Code echo off FOR F i IN CD DO set verzeichnis i echo Sverzeichnis Ausgabe C Programme Batch 57 Programmierungshilfen Vorsicht ist geboten bei Befehlen welche mehrzeilige Ausgaben produzieren und bei solchen welche in ihrer Ausgabe auch Leerzeichen enthalten k nnen Da das Standardtrennzeichen ein Blank ist muss man wenn man nicht will dass die Varia ble nur bis zum Blank gefiillt wird das Standardtrennzeichen ver ndern FOR F delims i IN CD DO set verzeichnis i entfernt je de Art von Trennzeichen Bei Befehlen welche mehrzeilige Ausgaben zur Folge haben bleibt jeweils die letzte Zeile in der Variablen erhalten 6 0 8 Dateien und Verzeichnisse auflisten Hier ist ein Beispiel in dem alle Dateien auf welche die Filterbedingung zutrifft aufgelistet werden Ausserdem werden die Dateianzahl und die Dateigr en zusam menaddiert echo off set Filter x x set A DateiAnzahl 0 set bytes 0 for R pfad f in Filter do set A DateiAnzahl 1 echo f 33 zfBytes set A bytes bytes zf echo echo dp0 Filter ec
37. L scht ohne Nachfrage ganze Verzeichnisb ume Kann in Batch Dateien praktisch sein Der Verzeichnisname darf keine Wildcards enthalten oder rmdir s q C temp 2 28 ren oder rename Datei en umbenennen 2 29 set set setzt eine tempor re Umgebungsvariable oder gibt die Variablenwerte aus Tempor r bedeutet jeweils nur f r die aktuelle cmd Session 2 30 setlocal setlocal Steuert die Begrenzung des Giiltigkeitsbereiches von Anderungen Wird mit endlocal beendet 2 31 start ffnet neues Fenster f r eigenes Programm Beispiel WinXP zum ffnen eines neuen Konsolenfensters in dem eine Datei aufgerufen wird start Name des neuen Fensters WAIT D C temp NORMAL call test bat WAIT Wartet bis Anwendung geschlossen wird NORMAL Startet Anwendung in der NORMAL Priorit tsklasse D Danach folgt das Startverzeichnis 2 32 taskkill Ab Windows XP kann man mit diesem Befehl einen Prozess beenden beispiels weise wenn dieser nicht mehr reagiert Unter Einbindung von t werden auch alle untergeordneten Prozesse beendet und wenn man f hinzuf gt wird das Beenden erzwungen 14 tasklist taskkill f iexplore exe t 2 33 tasklist Dieser Befehl listet alle aktiven Prozesse auf die gerade auf diesem Computer laufen Damit l sst sich zum Beispiel der Name eines zu beendenden Prozes ses ermitteln siehe unten taskkill Mit einem hinzugef gten nh werden die Spalten
38. Libraries or general purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work For example Corresponding Source includes interface definiti on files associated with source files for the work and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require such as by in timate data communication or control flow between those sub programs and other parts of the work The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Correspon ding Source The Corresponding Source for a work in source code form is that same work 2 Basic Permissions All rights granted under this License are granted for the term of copyright on the Program and are irrevocable provided the stated conditions are met This License explicitly affirms your unlimited permission to run the unmodified Program The out put from running a covered work is covered by this License only if the output given its content constitutes a covered work This License acknowledges your rights of fair use or other equiva lent as provided by copyright law You may make run and propagate covered works that you do not convey without conditions so long as your license otherwi se remains in force You may convey covered works to others for the sole purpose of having them make modi
39. RNAME absolute Angaben Die Eingabe von cd wechselt in das Hauptverzeichnis auf dem derzeitig befindlichen Laufwerk Die Eingabe von cd ORDNERNAME wechselt absolut in den Ordner ORDNER NAME auf dem derzeitig befindlichen Laufwerk Die Eingabe von LAUFWERKSBUCHSTABE ohne vorangestell tes cd wechselt in das aktuelle Verzeichnis des gew hlten Laufwerks LAUFWERKSBUCHSTABE Die Eingabe von cd LAUFWERKSBUCHSTABEORDNERNAME wechselt absolut in den Ordner ORDNERNAME auf dem gew hlten Laufwerk von LAUFWERKSBUCHSTABE jedoch nicht von einem Laufwerk auf ein anderes Pfadangaben mit Leerschl gen Bsp C program files m ssen in Anf hrungs Schlusszeichen eingeschlossen sein chep Der Befehl cd D dp0 wechselt in den Ordner des Batch Skripts sinnvoll bei Windows Doppelklicks Wildcards Ist die Pfadangabe eindeutig kann der Ordnername durch Nutzen von Wildcards z b win fiir windows oder winnt abgektirzt werden Dies ist jedoch im Batchbetrieb nicht ratsam Remotesysteme Pfade von nicht als Laufwerken verbundenen Remotesystemen k nnen Berechti gung vorausgesetzt entweder tiber die Administrative Freigabe oder durch das Verbinden eines Netzlaufwerks angesprochen werden Beispiel fiir administrative Freigabe computername laufwerk Weiterer Pfad Pfad in Variable Der Befehl set PFAD cd schreibt das aktuelle Verzeichnis in die Variable PFAD als letztes im Batch Script mit
40. U Projekt freie und quelloffene Alternativen bietet Eine kostenlose Alternative zum Batching bietet Microsoft selbst auf seiner Home page mit dem Tool PowerShell Weitere Tools sind im Abschnitt WebLinks aufgelistet http swissfileknife sourceforge net http de wikipedia org wiki Sed 20 28Unix 29 http www 7 zip org http de wikibooks org wiki Perl BRWN Re 89 10 Referenz 10 1 Liste aller internen und externen Befehle entspricht der Ausgabe des Befehls help unter Windows XP ASSOC AT ATTRIB BREAK CACLS CALL CD CHCP CHDIR CHKDSK CHKNTES CLS CMD COLOR COMP COMPACT CONVERT COPY DATE DEL Zeigt Dateierweiterungszuordnungen an bzw ndert sie Legt eine Zeit fest zu der Befehle und Programme auf die sem Computer ausgef hrt werden Zeigt Dateiattribute an bzw ndert sie Schaltet die erweiterte berpr fung f r STRG C ein bzw aus Zeigt Datei ACLs Access Control List an bzw ndert sie Ruft eine Batchdatei aus einer anderen Batchdatei heraus auf Zeigt den Namen des aktuellen Verzeichnisses an bzw ndert diesen Zeigt die aktive Codepagenummer an bzw legt diese fest Zeigt den Namen des aktuellen Verzeichnisses an bzw ndert diesen berpr ft einen Datentr ger und zeigt einen Statusbericht an Zeigt die berpr fung des Datentr gers beim Start an bzw ver ndert sie L scht den Bildschirminhalt Startet eine neue Instanz des Windows Befehlsinterprete
41. Weblinks http www heise de ct 03 16 136 default shtml c t 16 2003 S 136 Windows Befehlszeile http www ss64 com nt index html NT XP Batch Befehle en http www admini de Umfangreiche Informationen ber Batchprogrammierung unter NT 2000 XP http www fpschultze de Batch Scripting Site mit vielen Beispielen http sven of nine de site doku php faq batch gt Umfangreiche Funktionssamm lung f r Batchprogrammierer http www knowware de cat 6 1 amp book batch e http download knowware de batch pdf Leicht verst ndliche Einf hrung http publibz boulder ibm com cgi bin bookmgr_ 0S390 BOOKS IEA2BS1V CCONTENTS SHELF IEA2BK32 amp DN SA22 7598 01 amp DT 200106261339387 englischsprachiges JCL Benutzerhandbuch e http www plogmann net w 2 54 index htm Optionen des Befehls XCOPY http www antonis de dos download Diverse Beispielskripte http www easy coding de shellscripting html s 5fb492fd4b5 15b0c880795a6a7d92efSc4aed29c Forum tiber Shellscripting ADDN PWN KE http www heise de ct 03 16 136 default shtml http www ss64 com nt index html http www admini de http www fpschultze de http sven of nine de site doku php faq batch http download knowware de batch pdf http publibz boulder ibm com cgi bin bookmgr_0S390 B00KS TEA2B510 CCONTENTS SHELF IEA2BK32 amp DN SA22 7598 01 amp DT 20010626133938 http www plogmann net w 2 54 index htm http www antonis de dos download http www easy cod
42. Zeit in der If Schleife STIMES echo Warte nochmals ca 5 Sec ping n 5 localhost gt NUL echo 3 Zeit in der If Schleife STIMES echo Dabei ist es bereits STIMES pause Damit DATE und TIME die richtigen Werte ausgeben muss unbedingt die verz gerte Erweiterung von Umgebungsvariablen mit dem Befehl SETLOCAL ENABLEEXTENSIONS aktiviert werden Hier das korrekte Beispiel echo off SetLocal EnableDelayedExpansion echo Die aktuelle Zeit ist time 0 8 echo bitte ca 5 Sec warten ping n 5 localhost gt NUL echo jetzt sollten ca 5 Sec vergangen sein TIME liefert STIMES echo Jetzt gibt auch die FOR Schleife die korrekte Zeit aus for Air SU IN 0 Ly Sy DO Y echo TIME pause echo echo Auch in z amp nbsp B IF Schleifen ist es jetzt richtig if TRUE TRUE echo 1 Zeit in der If Schleife STIMES echo Warte ca 5 Sec ping n 5 localhost gt NUL echo 2 Zeit in der If Schleife STIMES echo Warte nochmals ca 5 Sec ping n 5 localhost gt NUL echo 3 Zeit in der If Schleife TIME echo Es ist jetzt STIMES EndLocal pause 6 0 4 Ausgaben besser anzeigen das ist OK Wenn man nicht die Ausgabe von Befehlen per echo off Ausblendet kann man am besten das Prompt ndern sodass man besser erkennen kann was passiert 2 Kapitel 2 30 auf Seite 14 55 Programmierungshilfen prompt G Der Prompt ist dann gt 6 0 5 Unterroutinen und Unterprogramme Unterroutin
43. ants to any of the parties who would receive the covered work from you a discriminatory patent license a in connection with copies of the covered work conveyed by you or copies made from those copies or b primarily for and in connection with specific products or compilations that contain the covered work unless you entered into that arrangement or that patent license was granted prior to 28 March 2007 Nothing in this License shall be construed as excluding or limit ing any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law 12 No Surrender of Others Freedom Tf conditions are imposed on you whether by court order agree ment or otherwise that contradict the conditions of this License they do not excuse you from the conditions of this License If you cannot convey a covered work so as to satisfy simultaneous ly your obligations under this License and any other pertinent obligations then as a consequence you may not convey it at all 13 2 GNU Free Documentation License Version 1 3 3 November 2008 Copyright 2000 2001 2002 2007 2008 Free Software Foun dation Inc lt http fsf org gt Everyone is permitted to copy and distribute verbatim copies of this license document but changing it is not allowed 0 PREAMBLE The purpose of this License is to make a manual textbook or other functional and useful document freein the sense of free dom
44. ation for a User Product means any me thods procedures authorization keys or other information re quired to install and execute modified versions of a covered work in that User Product from a modified version of its Cor responding Source The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made If you convey an object code work under this section in or with or specifically for use in a User Product and the conveying oc curs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpe tuity or for a fixed term regardless of how the transaction is cha racterized the Corresponding Source conveyed under this sec tion must be accompanied by the Installation Information But this requirement does not apply if neither you nor any third par ty retains the ability to install modified object code on the User Product for example the work has been installed in ROM The requirement to provide Installation Information does not include a requirement to continue to provide support service warranty or updates for a work that has been modified or in stalled by the recipient or for the User Product in which it has been modified or installed Access to a network may be denied when the modification itself materially and adversely affects the operation
45. aufwerke mit chkdsk erst berpr ft Wenn dabei ein Fehler auftritt wird mit fsutil das dirty Bit gesetzt Das bewirkt dass beim n chsten Systemstart die Fehler behoben werden AuBerdem werden die Partitionen in dem loop ausgelassen welche schon als dirty markiert sind Eine kleine Routine war auch n tig damit Netzwerklaufwerke ausgelassen werden echo off ed ZAGEN loop for i in c d e f g h i j k 1 m n 0 p q r s t u V w xX y z do if exist i NUL call defrag i echo echo pause ping localhost n 10 gt NUL goto loop defrag call check 1 if ok nein echo Laufwerk 1 wird ausgelassen echo goto eof echo echo echo chkdsk 1 v 83 Beispiele chkdsk 1 if Serrorlevel NEQ 0 if Serrorlevel NEQ 2 echo 1 chkdsk Fehler echo Errorlevel errorlevel echo echo setzte dirty Bit fsutil dirty set 1 echo echo Versuche Reparatur chkdsk 1 v x if terrorlevel EQU 2 echo Fehler bereinigt else echo Errorlevel errorlevel echo goto eof echo defrag 1 f defrag 1 f if Serrorlevel NEQ O pause exit rem pause ping localhost n 1 gt NUL goto eof Check set ok nein net use find i 1 gt NUL if not errorlevel 1 echo 1 ist ein Netzlaufwerk goto eof fsutil dirty query 1 for F tokens 5 f in fsutil dirty query 1 do if not S NICHT rem Laufwerk ist als fehlerhaft markiert goto eo
46. bining or lin king an Application with the Library The particular version of the Library with which the Combined Work was made is also called the Linked Version The Minimal Corresponding Source for a Combined Work means the Corresponding Source for the Combined Work ex cluding any source code for portions of the Combined Work that considered in isolation are based on the Application and not on the Linked Version The Corresponding Application Code for a Combined Work means the object code and or source code for the Application including any data and utility programs needed for reproducing the Combined Work from the Application but excluding the System Libraries of the Combined Work 1 Exception to Sec tion 3 of the GNU GPL You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL 2 Conveying Modified Versions If you modify a copy of the Library and in your modifications a facility refers to a function or data to be supplied by an App lication that the facility other than as an argument passed when the facility is invoked then you may convey a copy of the modified version a under this License provided that you make a good faith effort to ensure that in the event an Application does not supp ly the function or data the facility still operates and performs whatever part of its purpose remains meaningful or b under the GNU GPL w
47. by an organization as the authoritati ve definition of a standard You may add a passage of up to five words as a Front Cover Text and a passage of up to 25 words as a Back Cover Text to the end of the list of Cover Texts in the Modified Version Only one passage of Front Cover Text and one of Back Cover Text may be added by or through arrangements made by any one entity If the Document already includes a cover text for the same cover previously added by you or by arrangement made by the same entity you are acting on behalf of you may not add another but you may replace the old one on explicit permission from the previous publisher that added the old one The author s and publisher s of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version 5 COMBINING DOCUMENTS You may combine the Document with other documents released under this License under the terms defined in section 4 above for modified versions provided that you include in the combina tion all of the Invariant Sections of all of the original documents unmodified and list them all as Invariant Sections of your com bined work in its license notice and that you preserve all their Warranty Disclaimers The combined work need only contain one copy of this License and multiple identical Invariant Sections may be replaced with a single copy If there are multiple Invariant Section
48. cation for a work that was published at least four ye ars before the Document itself or if the original publisher of the version it refers to gives permission K For any section Ent itled Acknowledgements r Dedications Preserve the Title of the section and preserve in the section all the substance and tone of each of the contributor acknowledgements and or dedi cations given therein L Preserve all the Invariant Sections of the Document unaltered in their text and in their titles Section numbers or the equivalent are not considered part of the section titles M Delete any section Entitled Endorsements Such a section may not be included in the Modified Version N Do not retitle any existing section to be Entitled Endorsements r to conflict in title with any Invariant Section O Preserve any Warranty Disclaimers If the Modified Version includes new front matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document you may at your option designate some or all of these sections as invariant To do this add their titles to the list of Invariant Sections in the Modified Version s license notice These titles must be distinct from any other section titles You may add a section Entitled Endorsements provided it con tains nothing but endorsements of your Modified Version by various parties for example statements of peer review or that the text has been approved
49. chen Dagegen k nnen sich mehrfach vorhandene Anf hrungszeichen wieder aufheben Deshalb m ssen vom Benutzer angegebene Anf hrungszeichen erst entfernt werden bevor man in der eigenen Batchdatei neue setzt echo off echo Kopiert eine Datei in das eigene Benutzerprofil rem Die Anf hrungszeichen in der folgenden Zeile werden nur ben tigt rem damit zwischen dem Doppelpunkt und der Eingabe ein Abstand entsteht set p name Bitte geben Sie einen Dateinamen an rem In der folgenden Zeile werden alle Anf hrungszeichen entfernt da rem nach dem Gleichheitszeichen kein Ersattext folgt siehe auch set rem Das Set Kommando kommt sowohl beim Variablennamen als auch beim rem Inhalt ohne Anf hrungszeichen aus set name name rem An dieser Stelle sollte erst gepr ft werden ob die Datei berhaupt rem existiert aber das w rde den Rahmen hier sprengen copy name SHOMEDRIVE S HOMEPATH Eigene Dateien Theoretisch k nnte man auch mit den kurzen Dateinamen 8 3 arbeiten aber diese sind nicht eindeutig und k nnen von Laufwerk zu Laufwerk unterschiedlich sein Daher besser nicht verwenden Kombiniert in der gegebenen Reihenfolge zwei oder mehrere durch verbundene Textdateien in einer neuen Gesamtdatei In diesem Zusammenhang muss auf die Bedeutung der Parameter A f r ASCH Format der Standardwert und B f r Bin r Format eingegangen werden die jedem Dateinamen in obigem Beispiel mit einem Leerze
50. cht gel scht damit man sie fiir weitere Zwecke benutzen kann 85 Beispiele 8 0 17 Hosts Datei mit einem Aliasnamen und der aktuellen IP Adresse aktualisieren H ufig werden Webserver oder hnliche Programme unter Angabe eines Aliasna mens installiert damit sie leicht auf einen anderen Rechner verschoben werden k nnen falls der urspr ngliche Rechner defekt ist Oder die Aplikationl uft unter VM Ware auf einen Laptop bei dem sich die IP Adressen h ufig andern Dann kann mit dem Skript der Hostnamenalias mit der aktuellen IP Adresse aktualisiert werden Idealerweise wird das Script automatisch beim Start von Windows oder beim Anmelden des Anwenders ausgefiihrt echo off set HOST_ALIAS myserver myserver mydomain org set HOST_FILE SystemRoot System32 drivers etc hosts set TEMP_FILE TEMP hosts tmp REM vorhandenen Eintrag entfernen und den Rest in TEMP Datei schreiben type SHOST_FILE find v myserver gt STEMP_FILES REM Neuen Eintrag wieder hinzuftigen for F tokens 15 i in ipconfig find IP Ad do set IP i echo SIPS SHOST_ALIAS S gt gt STEMP_FILE S echo Added IP SHOST_ALIAS to the hostsfile REM Temp File nach SystemRoot System32 drivers etc hosts kopieren REM Die Datei Hosts darf nicht mit move verschoben werde sondern muss kopiert werden da sonst der Hostname nicht gefunden werden kann copy y STEMP_FILE HOST_FILE del F Q STEMP_FILES 8 0 18 Windowsversion herausfinden
51. d as Front Cover Texts or Back Cover Texts in the notice that says that the Document is released under this License A Front Cover Text may be at most 5 words and a Back Cover Text may be at most 25 words A Transparent copy of the Document means a machine readable copy represented in a format whose specification is available to the general public that is suitable for revising the document straightforwardly with generic text editors or for images composed of pixels generic paint programs or for drawings some widely available drawing editor and that is suitable for input to text formatters or for automatic translati on to a variety of formats suitable for input to text formatters A copy made in an otherwise Transparent file format whose markup or absence of markup has been arranged to thwart or discourage subsequent modification by readers is not Transpa rent An image format is not Transparent if used for any sub stantial amount of text A copy that is not Transparentis called Opaque For example if you agree to terms that obligate you to collect aroyalty for further conveying from those to whom you convey the Program the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program 13 Use with the GNU Affero General Public License Notwithstanding any other provision of this License you have permission to link or combine any covered work with a work licensed under v
52. d es dem Benutzer erlaubt sich von anderen Rechnern aus an diesem Rechner anzumelden Anstatt kann hier auch eine Liste von Computernamen an gegeben werden Dann darf sich der Benutzer nur von diesen Computern anmelden 2000 XP Hinweis Diese Arbeitsvorg nge gehen auch mit der Windows Benutzerkontensteue rung Diese kann erreicht werden durch Start Einstellungen Systemsteuerung Benutzer Hinweis Der Name des aktuell angemeldeten Benutzers ist in des Umgebungsva riable UserName Hinweis Hilfe zum Befehl Net User erh lt man durch Eingabe von Net User help Beispiel Um den Benutzer Otto mit dem Password Frieda einzurichten kann folgende Batch Datei ausgefiihrt werden net user Otto Frieda add net user Otto expires never net user Otto comment Default USER from This Computer net user Otto active Yes net user Otto 73 8 Beispiele 8 0 7 Regedit exe Eine kleine Batchdatei um mit regedit exe direkt einen bestimmten REG Zweig anzuspringen set LastKey HKEY_LOCAL_MACHINE SOFTWARE Microsoft Windows NT CurrentVersion Hot fix set Key HKEY_CURRENT_USER Software Microsoft Windows CurrentVersion Applets Regedit reg add Key f v LastKey d SLastKey start regedit exe Erl uterung e LastKey ist der Reg Schl ssel der als Letztes angezeigt wurde und dieser wird beim Start von regedit direkt angesprungen diesen Schl ssel kann man nach Belieben anpassen e Key ist der Reg Schl sse
53. d only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version If you use option 4d0 the Installation Information must accompany the Minimal Cor responding Source and Corresponding Application Code If you use option 4d1 you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for convey ing Corresponding Source that specified version or of any later version that has been pu blished not as a draft by the Free Software Foundation If the Document does not specify a version number of this License you may choose any version ever published not as a draft by the Free Software Foundation If the Document specifies that a proxy can decide which future versions of this License can be used that proxy s public statement of acceptance of a ver sion permanently authorizes you to choose that version for the Document 11 RELICENSING Massive Multiauthor Collaboration Site or MMC Site me ans any World Wide Web server that publishes copyrightable works and also provides prominent facilities for anybody to edit those works A public wiki that anybody can edit is an examp le of such a server A Massive Multiauthor Collaboration or MMC contained in the site means any set of copyrightable works thus published on the MMC site CC BY SA means t
54. dee es 13 2 24 Netsh seo eo A ha a at oe ee 13 22257 path 2 2 Krise ae a W Actas Sore eee AE vs 13 2 26 prompt 21 4 Es 4 8 aw ad an Sh eh Ald aha Sc Soe 13 2 27 rd rmdir 2 oo oo 13 IH Inhaltsverzeichnis IV 2 28 2 29 2 30 2 31 2 32 2 33 2 34 2 35 2 36 2 37 3 1 3 2 3 3 3 4 3 5 3 6 3 7 3 8 3 9 3 10 3 11 3 12 3 13 3 14 3 15 3 16 3 17 SOU a a Cet ld Bar SS oe he et the O STALL re ee Bat tie Soe cP Ny ee ee CAED ua Re ate ao a NS BN ees ECHO ao earann A A Karen aa START mota Ar ee ee a ade ye ii dd Variablen Batch Operatoren 4 1 4 2 4 3 4 5 4 6 4 7 N ee Birken Erweiterungen unter Windows NT 5 1 Batchparameter o o e Inhaltsverzeichnis 5 2 Stringmanipulation e e 47 5 3 Umgebungsvariablen o 49 5 4 Die Kommandozeile lernt Rechnen 50 5 5 Benutzereingaben o 51 5 6 Ausgaben in eine Variable umleiten 51 6 Programmierungshilfen 53 7 Netzwerkumgebung 65 1 1 pine 4 shee ee Said Sate aa eo ee Be a 65 1 2 APCOMM ioa Seg eho OR ee des en es 66 DO APACHE uta Gerona bo ae ls OP une He re aa 68 TA netstat S o u ee ee 69 KI NET 20 25 22 en A ee ES ee ES 69 8 Beispiele 75 9 Zusatz Tools 89 10 Referenz 91 10 1 Liste aller internen und externen Befehle entspricht der Ausgabe des Befehls help unter Windows XP
55. die Option p ben tigt Beispiel set p EINGABE Variable Eingeben echo SEINGABES Mit Variablen Rechnen Rechnungen mit Variablen sind erst mit der Option a m glich Beispiel set WERT1 2 set WERT2 21 set a WERT1 WERT1 x WERT2 echo SWERT1 39 4 Batch Operatoren 4 1 Befehlsverkettung mehrere Batch Befehle in einer Zeile k nnen hintereinander ausgef hrt werden Syntax befehll amp befehl2 Stapelanweisung Ab bis Windows 7 Beispiel Inhalt echo Hallo amp echo und Tsch ss Ausgabe Hallo und Tsch ss 4 2 Befehlsverkettung mittels pipe der zweite Befehl bekommt die Ausgabe des ersten Befehls als Eingabe Syntax befehll befehl2 Stapelanweisung Ab DOS nur fiir more als zweiter Befehl allgemein verwendbar ab WindowsNT bis Windows 7 Beispiel Inhalt type test txt more 41 Batch Operatoren Ausgabe Zeile 1 Zeile 2 Zeile 24 lt gt MOXS nach Driicken einer beliebigen Taste werden die n chsten Zeilen angezeigt 4 3 amp amp bedingte Befehlsverkettung der zweite Befehl wird nur ausgefiihrt wenn der erste Befehl erfolgreich war Syntax befehll amp amp befehl2 Stapelanweisung Ab bis Windows 7 Beispiel Inhalt copy test txt test2 txt amp amp echo Kopieren erfolgreich Ausgabe Kopieren erfolgreich falls test txt existiert und nach test2 txt kopiert werden konnte 4 4 Il bedingte Befehlsverkettung der zweite Befehl
56. ding a physical distribution medium accompanied by a written offer valid for at least three years and valid for as long as you offer spare parts or customer support for that product model to give anyone who possesses the object code either 1 a copy of the Corresponding Source for all the software in the product that is covered by this License on a durable physical medium custo marily used for software interchange for a price no more than your reasonable cost of physically performing this conveying of source or 2 access to copy the Corresponding Source from a network server at no charge c Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source This alternative is allowed only oc casionally and noncommercially and only if you received the object code with such an offer in accord with subsection 6b d Convey the object code by offering access from a designa ted place gratis or for a charge and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge You need not require recipients to copy the Corresponding Source along with the object code If the place to copy the object code is a network server the Cor responding Source may be on a different server operated by you or a third party that supports equivalent copying facilities provided you maintain clear directions next to the object code saying where to find the
57. e exe 3 16 Startet START ein Programm Syntax START Titel D lt Pfad gt 1 MIN MAX SEPARATE SHARED LOW NORMAL HIGH REALTIME WAIT B Befehl Programm Parameter 35 Batch Befehle Optionen e Titel Der Titel des neuen Fensters e D lt Pfad gt Startverzeichnis e I Die neue Umgebung soll die dem CMD EXE beim Aufruf bergebene sein und nicht die aktuelle Umgebung e MIN Startet das Fenster minimiert e MAX Startet das Fenster maximiert e SEPARATE Startet 16 Bit Windows Programm in separatem Speicherbereich e SHARED Startet 16 Bit Windows Programm in gemeinsamen Speicherbereich e LOW Startet Anwendung in IDLE Priorit tsklasse e NORMAL Startet Anwendung in der NORMAL Priorit tsklasse e HIGH Startet Anwendung in der HIGH Priorit tsklasse e REALTIME Startet Anwendung in der REALTIME Priorit tsklasse e WAIT Startet die Anwendung und wartet auf das Ende e B Startet die Anwendung ohne ein neues Fenster zu ffnen Die Anwendung ignoriert STRG C Wenn die Anwendung nicht selbst ndig STRG C berpr ft ist STRG UNTBR die einzige M glichkeit um die Anwendung abzubrechen e Gibt die Hilfe aus Hier eine Liste der n tzlichen System Programme die man so ausf hren kann regedit exe neuer Registrierungseditor regedt32 exe lterer Registrierungseditor explorer exe Windows Ordner Explorer taskmgr exe Wind
58. e gt expires never Damit wird eingestellt dass dass Passwort des Benutzers lt name gt niemals abl uft 2000 XP Net User lt name gt active Yes Net User lt name gt active No Damit wird das entsprechende Benutzerkonto aktiviert oder deaktiviert 2000 XP Net User lt name gt passwordchg Yes Net User lt name gt passwordchg No Damit wird eingestellt ob der Benutzer sein eigenes Passwort ver ndern darf 2000 XP Net User lt name gt comment Herr Maier vom Verkauf Damit wird der Benutzerkommentar ver ndert 2000 XP Net User lt name gt Fullname Karl Otto Maier M ller Damit wird der komplette Benutzername ver ndert 2000 XP Net User lt name gt expires 2009 12 31 72 NET Damit wird eine Zeit vorgegeben nach der der Benutzer sein Password ndern muss 2000 XP Net User lt name gt profilepath D Maier Net User lt name gt scriptpath D Maier Net User lt name gt homedir D Maier Net User lt name gt homedirreq Yes Net User lt name gt homedirreq No Damit wird eingestellt wo sich die Benutzerdaten befinden Der Ort der Benutzer daten wird in der Umgebungsvariable USERPROFILE gespeichert 2000 XP Net User lt name gt countrycode 049 Damit wird die L ndereinstellung ver ndert 2000 XP Net User lt name gt workstations x Damit wir
59. e license is included in the section entitled GNU Free Documentation License If you have Invariant Sections Front Cover Texts and Back Cover Texts replace the with Texts line with this with the Invariant Sections being LIST THEIR TITLES with the Front Cover Texts being LIST and with the Back Cover Texts being LIST If you have Invariant Sections without Cover Texts or some other combination of the three merge those two alternatives to suit the situation If your document contains nontrivial examples of program code we recommend releasing these examples in parallel under your choice of free software license such as the GNU General Public License to permit their use in free software 5 Combined Libraries You may place library facilities that are a work based on the Li brary side by side in a single library together with other library facilities that are not Applications and are not covered by this License and convey such a combined library under terms of your choice if you do both of the following a Accompany the combined library with a copy of the same work based on the Library uncombined with any other library facilities conveyed under the terms of this License b Give prominent notice with the combined library that part of it is a work based on the Library and explaining where to find the ac companying uncombined form of the same work 6 Revised Versions of the GNU Lesser General Public License
60. e wikibooks org w index 47 http de wikibooks org w index Kassad 48 http de wikibooks org w index 49 http de wikibooks org w index 50 http de wikibooks org w index 51 http de wikibooks org w index 52 http de wikibooks org w index 53 http de wikibooks org w index 54 http de wikibooks org w index 55 http de wikibooks org w index ajewsky 3 9 O S 9 T 9 9 9 a y T D O o T o TT T Y hp hp hp hp hp hp hp hp hp hp hp hp hp hp hp hp hp hp hp hp EJ ti ti EJ L ti oak ti ti EJ Ed ti ti ti ti E Ed ti ti Ed CH ch Set Cr ql amt rt re a co ct Cher Ch Che CP Cer oct cr le Benu le Benu Lzer Lzer Komikaa Kronos86m le Benu le Benu le Benu le Benu le Benu le Benu le Benu Lzer Czer Lzer Lzer Lzer Lzer Lzer F Warburg ichaelFrey ichfrm jchael omike Ocrho Pc world le Benu Lzer le Benu le Benu le Benu le Benu Lzer tzer Prince_ Lzer Lzer Peperkorn Produnis Prog le Benu le Benu Lzer Reseka Robert le Benu le Benu Lzer Lzer Robidog le Benu le Benu zer Lzer Schneijo Se4598 Lzer Stefan_ 99 Autoren Stefan wichmann gt StefanTiran Sys Bak ThePacker Theres no global warming Timon Freitag Tsch fer Uwe kausch WeiBNix Wolfgangbeyer
61. ehalten Mit dem Befehl COLOR kann man die Vorder und Hintergrundfarbe ver ndern Die COLOR Werte bestehen aus zwei HEX Werten 0 Schwarz 1 Dunkelblau 2 Dunkelgriin 3 Blaugriin 4 Dunkelrot 5 Lila 6 Ocker 7 Hellgrau 22 COMMAND 8 Dunkelgrau 9 Blau A Gr n B Zyan C Rot D Magenta E Gelb F Wei Der Befehl COLOR 2F ergibt z B einen gr nen Hintergrund mit wei er Schrift 3 3 COMMAND Startet einen neuen Kommandointerpreter Dieser kann mit exit wieder beendet werden Syntax command Laufwerk Pfad Ger t e 1 u P MSG LOW Y c k Befehl Konsole Ab MS DOS bis Windows XP Beispiel Inhalt command Ausgabe unter Windows 95 C WINDOWS gt command Microsoft R Windows 95 C Copyright Microsoft Corp 1981 1996 C WINDOWS gt 23 Batch Befehle 3 9 ECHO Gibt einen Text aus oder schaltet die Befehlszeilen an aus Wenn ein Text ausge geben wird k nnen dort auch Variablen angezeigt werden wie z B die Variable Jover in Windows XP os Syntax echo text ON OFF oder alternativ echo text Interner Befehl Ab MS DOS bis Windows NT 5 1 XP Beispiel Inhalt echo off echo Die aktuelle Datei heift 0 echo Die aktuelle Version Ihrer Befehls Konsole oder OS hei t Sver Ausgabe Die aktuelle Datei heift beispiel bat Die aktuelle Version Ihrer Befehls Konsole oder OS hei t Windows NT Mit echo
62. en kann man mittels goto oder call und Unterprogramme mit Hilfe von call realisieren call unterroutine Hallo echo Fertig goto eof unterroutine echo Ubergebener Parameter an Unterroutine 1 goto eof Beachten Sie dass Sie beim Aufruf von Unterroutinen per call Probleme mit Filehandles bekommen k nnen Dies liegt darin begriindet dass ein Aufruf per call als Aufruf eines Unterprogramms interpretiert wird w hrend es sich bei goto stets um Unterroutines handelt Anmerkung goto eof ist eine Spezialmarke mit der Sie stets zum Ende Ihres Skriptes bzw Ihrer Unterroutine springen 6 0 6 Benutzereingaben mittels set P echo off set P w i nstallieren dJeInstallieren REM die option I beim if bewirkt dass nicht REM zwischen Gross und Kleinschreibung REM unterschieden wird if I Sws i goto Install if I Sws d goto Deinstall echo Fehler w goto ende Install echo installieren ausgew hlt goto ende Deinstall echo deInstallieren ausgew hlt goto ende 56 Ausgaben in eine Variable umleiten ende echo pause 6 0 7 stdout in Umgebungsvariable speichern Falls man den stdout in einer Umgebungsvariable speichern m chte muss man das komplizierter umsetzen Es gibt zwei verschiedene M glichkeiten dies anzuge hen befehl set P variable funktioniert n mlich nicht Stattdessen braucht man BEFEHL gt temp txt set p BefehlOutput lt temp txt del temp txt Oder FOR
63. enkt wird landen Fehlerausgaben immer noch auf dem Bildschirm was oft erwiinscht ist Falls nicht kann auch die Fehler Ausgabe in eine Datei umgeleitet werden und zwar mit 2 gt Beispiel dir gt stdout txt 2 gt stderror txt Schreibt den Output des dir Befehles in die Datei stdout txt da kein Fehler aufgetreten ist dir DieseDateiExistiertNicht txt gt stdout txt 2 gt stderror txt Schreibt die Fehlermeldung des dir Befehles in die Datei stderror txt da die Datei DieseDateiExistiertNicht txt nicht existiert uns somit ein Fehler auftritt Wenn die Fehlerausgabe in die gleiche Datei wie die Standardausgabe umgeleitet werden soll h ngt man noch 2 gt amp 1 an Beispiel type EineDatei txt gt UmgeleiteteAusgabe txt 2 gt amp 1 Der Inhalt der Datei EineDatei txt wird in die Datei UmgeleiteteAusgabe txt kopiert wenn EineDatei txt existiert type EineDateiDieNichtExistiert txt gt UmgeleiteteAusgabe txt 2 gt amp 1 Wenn die Datei EineDateiDieNichtExistiert txt nicht existiert dann wird die Fehler meldung nicht im Dos Fenster stdout ausgegeben sonderen die Ausgabe wird auch in die Datei UmgeleiteteAusgabe txt geschrieben 44 gt gt 4 7 gt gt Umleitung der Standard Ausgabe mit Anh ngen des Textes falls die Datei schon existiert sonst wird die Datei wie bei gt siehe oben angelegt Syntax befehl gt gt file Stapelanweisung Ab bis Windows 7 Beispiel Inhalt echo Hallo gt tmp txt ec
64. er Verwendung mehrerer Befehle muss zwischen Bedingung und der Klammer ein Leerzeichen sein Falsch IF Bedingung Richtig IF Bedingung Befehll Befehl2 31 Batch Befehle 3 12 1 Syntax Vergleiche IF lt NOT gt Variablel Variable2 IF Variable EQU Variable2 Befehl An die Stelle von EQU kann jede der Optionen gesetzt werden NOT Der Befehl wird nur ausgef hrt wenn die Bedingung NICHT Wahr ist Optional ist gleich EQU ist gleich NEO nicht gleich LSS kleiner als LEQ kleiner als oder gleich GTR gr er als GEQ gr er als oder gleich 3 12 2 Hinweis zu UND bzw ODER Verkn pfung Eine UND bzw ODER Verkn pfung von zwei Bedingungen scheint nicht direkt m glich zu sein Beim Vergleichen von Strings hilft es aber eventuell wenn man die beiden Strings miteinander verkettet Beispiel set A true set B false if SAS SBS true true echo A und B sind beide TRUE else echo entweder A oder B sind nicht TRUE Als Workaround k nnen mehrere aufeinanderfolgende IFs zu einer UND bzw ODER Verkn pfungen kombiniert werden Bei einer ODER Verkn pfung wird der Code ausgef hrt sobald eine der Bedingungen wahr ist Wenn alle Bedingungen gepr ft wurden und keine erfolgreich war werden die Befehle im ELSE Zweig ausgef hrt 32 PAUSE set A true set B false if SAS true goto WAHR Diese Zeile ist doch erf llt also solltd
65. ersion 3 of the GNU Affero General Public Li cense into a single combined work and to convey the resulting work The terms of this License will continue to apply to the part which is the covered work but the special requirements of the GNU Affero General Public License section 13 concerning interaction through a network will apply to the combination as such 14 Revised Versions of this License The Free Software Foundation may publish revised and or new versions of the GNU General Public License from time to time Such new versions will be similar in spirit to the present version but may differ in detail to address new problems or concerns Each version is given a distinguishing version number 1f the Program specifies that a certain numbered version of the GNU General Public License or any later version applies to it you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation If the Program does not specify a version number of the GNU General Public License you may choose any version ever published by the Free Software Foun dation If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used that proxy s public statement of acceptance of a version permanent ly authorizes you to choose that version for the Program Later license versions may give you additional or different
66. extdatei ndert die Eingabeaufforderung Speichert das aktuelle Verzeichnis und wechselt dann zu einem anderen Verzeichnis Entfernt ein Verzeichnis Stellt lesbare Daten von einem besch digten Datentr ger wieder her Leitet Kommentare in einer Batchdatei bzw CONFIG SYS ein Benennt eine Datei bzw Dateien um Benennt eine Datei bzw Dateien um Ersetzt Dateien L scht ein Verzeichnis Setzt oder l scht die Umgebungsvariablen bzw zeigt sie an Beginnt den lokalen G ltigkeitsbereich von Umgebungs nde rungen in einer Batchdatei Ver ndert die Position ersetzbarer Parameter in Batchdateien Sortiert die Eingabe Startet ein eigenes Fenster um ein bestimmtes Programm oder einen Befehl auszuf hren Weist einem Pfad einen Laufwerksbuchstaben zu Zeigt alle zurzeit laufenden Aufgaben inklusive der Dienste an Bricht einen laufenden Prozess oder eine Anwendung ab oder beendet ihn bzw sie Zeigt die Systemzeit an bzw legt sie fest Legt den Fenstertitel f r das Eingabeaufforderungsfenster fest Zeigt die Ordnerstruktur eines Laufwerks oder Pfads grafisch an Zeigt den Inhalt einer Textdatei an 93 Referenz VER VERIFY VOL XCOPY 94 Zeigt die Windows Version an Legt fest ob berwacht werden soll ob Dateien korrekt auf den Datentr ger geschrieben werden Zeigt die Datentr gervolumebezeichnung und die Seriennum mer an Kopiert Dateien und Verzeichnisb ume 1 1 WebLinks 11 1
67. f set ok ja goto eof Als Alternative gibt es das Open Source Program JkDefrag welches auch alle Laufwerke nacheinander defragmentiert 1 http www kessels com JkDefrag 84 NET 8 0 15 Dateiinformationen anzeigen Dieses Batch Skript zeigt Informationen ber die Datei die als Parameter bergeben wird an beispielsweise per Drag amp Drop auf die Batch Datei echo off echo Attribute iia al echo Lavtwerk eiers 5 see s sede ooo dl echo kompletter Pfad AMEL echo Dateinane cera rado Borel ECHO Ordnerpfad iii e Se API echo kompletter Pfad kurze Form sl echo Aenderungsdatum tl echo Dateierweiterung S xl echo Dateigroesse 2 S Z1 pause Hinweis Falls die Attribute des eigenen Batch Skripts ausgelesen werden sol len so muss der Parameter Null verwendet werden Beispielsweise pO Eine Kombination ist auch m glich z B dp0 Laufwerk Pfad 8 0 16 Alle verf gbaren PCs im aktuellen Netzwerk suchen Dieses Batch Skript pingt alle IP Adressen eines IP Bereichs an und zeigt dann die PCs an die verf gbar sind echo off if exist ips txt del ips txt gt nul echo Bitte geben Sie den ersten Teil der IP ein set p ip for L N IN 1 1 echo Die IP ip N wird nun angepingt ping ip N n 1 w 1 find TTL amp amp echo ip N gt gt ips txt cls type ips txt pause gt nul Hinweis Die Datei ips txt wird ni
68. fications exclu sively for you or provide you with facilities for running those works provided that you comply with the terms of this License in conveying all material for which you do not control copy right Those thus making or running the covered works for you must do so exclusively on your behalf under your direction and control on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you Conveying under any other circumstances is permitted solely under the conditions stated below Sublicensing is not allowed section 10 makes it unnecessary 3 Protecting Users Legal Rights From Anti Circumvention Law No covered work shall be deemed part of an effective techno logical measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996 or similar laws prohibiting or restricting cir cumvention of such measures When you convey a covered work you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work and you disclaim any intention to limit operation or modification of the work as a me ans of enforcing against the work s users your or third parties legal rights to forbid circumvention of technological measures 4 Conveying Verbatim Copies You may convey verbatim copies
69. ght holder notifies you of the violation by some reasonable means this is the first time you have received notice of violation of this License for any work from that copyright holder and you cure the violation prior to 30 days after your receipt of the notice Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License If your rights have been terminated and not permanently reinstated you do not qualify to receive new licenses for the same material under section 10 9 Acceptance Not Required for Having Copies You are not required to accept this License in order to recei ve or run a copy of the Program Ancillary propagation of a covered work occurring solely as a consequence of using peer to peer transmission to receive a copy likewise does not requi re acceptance However nothing other than this License grants you permission to propagate or modify any covered work The se actions infringe copyright if you do not accept this License Therefore by modifying or propagating a covered work you in dicate your acceptance of this License to do so 10 Automatic Licensing of Downstream Recipients Each time you convey a covered work the recipient automati cally receives a license from the original licensors to run mo dify and propagate that work subject to this License You are not responsible for enforcing compliance by third parties with
70. gibt es folgende Syntax date 6 4 del erase Beispiel z gt echo date 6 4 2010 Hier werden vom Datum die ersten 6 Zeichen weggelassen und dann vier Stellen angezeigt Bei time funktioniert das analog Bei einigen Betriebssystemversionen erfordert das Andern des Systemdatums administrative Rechte XP Die Ausgabe des Datumsformates ist abh ngig von den Einstellungen in den Regions und Sprachoptionen Systemsteuerung 2 10 del erase L scht eine Datei die sich im aktuellen Verzeichnis befindet Als Parameter muss mindestens der Dateiname angegeben werden Weitere Parameter sind optional e p sollen mehrere Dateien gel scht werden muss jede einzelne L schung best tigt werden e f auch schreibgesch tzte Dateien werden gel scht e s l scht auch Dateien die sich in den Unterverzeichnissen befinden e q Unterbindet Best tigung Beispiel erase H zul schendedatei bat 2 11 deltree L scht Verzeichnis se inkl untergeordnete Dateien Unter Windows XP lautet der Befehl rmdir Deltree kennt es nicht mehr Anmer kung rmdir rd versteht keine Wildcards oder im Verzeichnisnamen 1 Kapitel 2 34 auf Seite 15 Wichtige DOS Kommandos 2 12 dir Der Befehl dir directory zeigt alle Verzeichnisse und Unterverzeichnisse an Verzeichnisse werden seit Windows 95 als Ordner bezeichnet unterscheiden sich allerdings nicht von Verzeichnissen Der d
71. gnet Hierzu verwendet man Sprachen wie C C und Java nicht zu verwechseln mit JavaScript Viele wiederkehrende Installations und Verwaltungsaufgaben die man traditionell mit Tastatur und Maus ausfiihrt lassen sich mit Stapeldateien ausf hren Hat man gentigend Kommentarzeilen in die Batchdatei eingefiigt geniigt der Ausdruck der Stapeldatei meist als Dokumentation Kommandozeilenbefehle und Batchdateien sind keine veraltete Technologie Auf Wunsch vieler Systemadministratoren hat Microsoft daf r gesorgt dass Windows Server 2003 vollst ndig von der Kommandozeile installiert und administriert werden kann ohne die Maus zu benutzen In diesem Buch geht es ausschlie lich um die Erstellung von Batch Dateien unter Windows und DOS Andere Betriebssysteme bieten vergleichbare und wesentlich m chtigere Funktionen wie z B die in der Linux Welt weit verbreitete Bash oder AppleScript f r den Mac 1 http de wikibooks org wiki Compiler Allgemeine Information Die Begriffe Stapelprogramm und Stapelverarbeitung r hren aus der Zeit her als Permanentspeicher auf Magnetplatten sehr teuer war Zu dieser Zeit begab man sich mit einem Stapel Lochkarten aus Pappe auf denen sich das Programm und die Daten in gestanzter Form befanden zum Rechenzentrum und tibergab dem Operator seinen Stapel Die Stapel aller Benutzer wurden gesammelt und dann sequentiell an den Rechner bergeben Nach einiger Zeit Konnte man sich dann die meist a
72. he Creative Commons Attribution Share Alike 3 0 license published by Creative Commons Corporation a not for profit corporation with a principal place of business in San Francisco California as well as future copyleft versions of that license published by that same organization Incorporate means to publish or republish a Document in who le or in part as part of another Document An MMC is ligible for relicensingif it is licensed under this License and if all works that were first published under this License somewhere other than this MMC and subsequently in corporated in whole or in part into the MMC 1 had no cover texts or invariant sections and 2 were thus incorporated prior to November 1 2008 The operator of an MMC Site may republish an MMC contai ned in the site under CC BY SA on the same site at any time before August 1 2009 provided the MMC is eligible for reli censing ADDENDUM How to use this License for your docu ments To use this License in a document you have written include a copy of the License in the document and put the following copyright and license notices just after the title page Copyright C YEAR YOUR NAME Permission is granted to copy distribute and or modify this document under the terms of the GNU Free Documentation License Version 1 3 or any la ter version published by the Free Software Foundation with no Invariant Sections no Front Cover Texts and no Back Cover Texts A copy of th
73. he Document means that it remains a section Entitled XYZ ccording to this definition The Document may include Warranty Disclaimers next to the notice which states that this License applies to the Document These Warranty Disclaimers are considered to be included by reference in this License but only as regards disclaiming war ranties any other implication that these Warranty Disclaimers may have is void and has no effect on the meaning of this Li cense 2 VERBATIM COPYING You may copy and distribute the Document in any medium eit her commercially or noncommercially provided that this Licen se the copyright notices and the license notice saying this Li cense applies to the Document are reproduced in all copies and If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms reviewing courts shall apply local law that most closely appro ximates an absolute waiver of all civil liability in connection with the Program unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program and you want it to be of the greatest possible use to the public the best way to achieve this is to make it free software which everyone can redistribute and change under these terms To do so attach the following notices to the program I
74. hleifen kann man Aktionen eine bestimmte Anzahl oft ausf hren Dazu muss man den Parameter L angeben Syntax for L Variable IN Startzahl Schrittweite Endzahl DO Aktion REM Schreibe Text 5 Mal for L N IN 1 1 5 DO echo Nummer N Ausgabe C gt for L N IN 1 1 5 DO echo Nummer N C gt echo Nummer 1 ummer 1 C gt echo Nummer 2 ummer 2 C gt echo Nummer 3 ummer 3 C gt echo Nummer 4 ummer 4 C gt echo Nummer 5 ummer 5 verschachtelte Z hlschleife for L N IN 1 1 5 DO for L N IN 1 1 N DO echo Nummer N Ausgabe C gt for L N IN 1 1 5 DO for L N IN 1 1 N DO echo Nummer N C gt for L N IN 1 1 1 DO echo Nummer N C gt echo Nummer 1 Nummer 1 C gt for L N IN 1 1 2 DO echo Nummer N 27 Batch Befehle C gt echo Nummer 1 C gt echo Nummer 2 C gt for C gt echo Nummer 1 C gt echo Nummer 2 C gt echo Nummer 3 C gt for C gt ec N N N N ummer C gt ec ummer C gt ec ummer C gt ec ummer ho 4 C gt for C gt ec N N N N N ummer C gt ec ummer C gt ec ummer C gt ec ummer C gt ec ummer no ho 3 Nummer Nummer ira ole ole a Nummer Nummer Nummer oon En oe oe zZ Nummer Nummer Nummer Nummer S p o oe zZ Nummer Nummer Nummer N
75. ho Es sind DateiAnzahl Dateien vorhanden echo Alle Dateien zusammen bytes Bytes set A kbytes bytes 1024 echo umgerechnet sind das kbytes KBytes echo pause 6 0 9 Pause Oft ist es hilfreich dass ein nach dem Beenden des Batch Programms das Einga beaufforderungsfenster offen bleibt So kann man Ausgaben nachlesen oder evtl aufgetretene Fehler entdecken Nun k nnte man einfach am Ende eine pause einfii gen Dabei kann der User einfach das Fenster schliefen oder ENTER driicken Man kann aber auch einfach eine zeitliche Pause mit ping realisieren echo off echo Ich schlie e gleich 58 Ausgaben in eine Variable umleiten ping localhost n 2 gt NUL Dabei kann man die Zeit mit dem Parameter n variieren Bei installiertem ResourceKit steht der Befehl sleep zur Verf gung welcher dieselbe Funktionalit t zeitliche Pause bietet 6 0 10 Minimiert ausfiihren Hin und wieder ist es sinnvoll dass die Batchdatei minimiert ausgef hrt wird z B eine Login Batch Datei Es ist m glich dass man die Batchdatei normal startet und sie sich selber minimiert ausf hrt Der Nachteil ist allerdings dass sich kurzzeitig ein Eingabeaufforderungs Fenster ffnet echo off if not 1 goto 1 start MIN cmd exe C nx0 begin goto eof begin echo Hallo ich laufe minimiert pause goto eof Noch eine Konstruktion ganz ohne Labels nach diesem Newsgroup Beitrag set set 18start dpnx0 mi
76. ho Haallooo gt gt tmp txt type tmp txt Ausgabe Hallo Haallooo Hier gilt analoges f r die Fehler Ausgabe siehe Operator gt oben 45 5 Erweiterungen unter Windows NT Unter Windows NT Windows 2000 und Windows XP stehen einige weitere Befehle zur Verfiigung zum Teil sind dort auch erweiterte Optionen fiir Standard Befehle enthalten 5 1 Batchparameter Die Parameter lassen sich jetzt folgenderma en erweitern fiir 1 setze man den jeweiligen Parameter ein a oe Anftihrungszeichen werden entfernt vollst ndige Pfadbezeichnung Laufwerkbuchstabe Pfad ohne Laufwerksbuchstabe Dateiname Dateinamenserweiterung Pfad nur mit kurzen Verzeichnis Dateinamen ttp de wikipedia org wiki 8 3 8 3 Konvention Dateiattribute 1 Datums und Uhrzeitangaben der Datei Ge ndert am Gr e der Datei AJP oP oP oP al I el eee ne dP oe A 0 ee ee Noto PuxXxX DT a mr a oe Die Angaben k nnen auch kombiniert werden z B dp0 ist Laufwerksbuchstaben Pfad der aktuellen Batchdatei 5 2 Stringmanipulation Mit folgender Syntax lassen sich Teile aus einer Zeichenkette extrahieren set str Hallo set str Sstr 71 echo str 47 Erweiterungen unter Windows NT Die angegebene positive Zahl gibt an wie viele Zeichen links tibergangen werden sollen Dieser Ausdruck liefert daher den Teilstring allo von Hallo set str Hallo set str Sstr 7 4 echo str
77. ichen Abstand vorangehen k nnen DOS Textdateien enthalten ein Dateiendezeichen Dezimal 26 Hexadezi mal 1A Beim Kopiervorgang darf in der Gesamtdatei nur als letztes Zeichen ein Dateiendezeichen erscheinen sonst w rde der Text nach der ersten Endmarkierung nicht mehr angezeigt copy kopiert ohne das abschlie ende Zeichen und f gt als letztes wieder eines zur Gesamtdatei hinzu M chte man Dateien mit bin ren Inhalten zusammenf gen z B PostScript Dateien die auch bin re Abschnitte enthalten k nnen so w rde ohne Parameter B ebenfalls nur bis zu einem zuf llig vorkommenden Dateiendezeichen kopiert und 81 Beispiele damit das Ergebnis unbrauchbar copy b seite 1 ps b seite 2 ps Neue Datei ps Als Zieldatei sollte man keine der Quelldateien verwenden da m glicherweise sonst der Inhalt tiberschrieben wird 8 0 13 Message Ping Mit Hilfe des folgenden Scripts kann man Windows um eine niitzliche Funktionalitat erweitern Mit Hilfe von mping erh lt man eine Nachricht sobald der gepingte Computer wieder erreichbar ist Um das Script global zu verwenden muss es z B als mping cmd in Windows Installationsordner System32 gespeichert werden und kann von nun an z B mit mping google com aufgerufen werden echo off wenn kein remote Host angegeben ist dann gehe zu Syntax IF 1 GOTO Syntax IF 1 GOTO Syntax IF 1 h GOTO Syntax IF 1 help GOTO Syntax
78. ichen k nnen bei dem Programmieren einer Batch Datei zu Fehlern fiihren Bei den nachfolgenden Beispielen ist also auf die Setzung von Leerzeichen und auf entsprechende Bemerkungen genau zu achten Scheinbar grundlose Abbriiche beim Ausf hren einer Batch Datei k nnen ebenfalls fehlplatzierten oder fehlenden Leerzeichen geschuldet sein 3 2 Schaltet die Ausgabe der Befehlszeile auf dem Bildschirm nur fiir den aktuellen Befehl aus und ist selbst kein eigener Befehl Syntax befehl Stapelanweisung Ab MS DOS bis Windows 7 Beispiel Inhalt echo Diese Zeile wird mit Befehlszeile ausgefuehrt echo und diese ohne Ausgabe C gt echo Diese Zeile wird mit Befehlszeile ausgefuehrt Diese Zeile wird mit Befehlszeile ausgefuehrt und diese ohne In Batch Files verhindert echo off zu Beginn des Skriptes die Ausgabe aller Befehlszeilen auf dem Bildschirm bis die Stapelverarbeitung beendet wird abbricht oder mittendrin ein echo on Befehl erfolgt um z B Befehlszeilen 17 Batch Befehle tats chlich anzuzeigen und dann auszuf hren Kommentare mit oder REM werden nat rlich auch nicht angezeigt Ist aber nur ein Nebeneffekt echo off REM Verhindert dass dieser Kommentar angezeigt wird Ohne echo off C gt REM Dieser Kommentar wird so angezeigt 3 3 Doppelpunkt Sprungmarke f r ein Unterprogramm bzw eine Kommentarzeile Sprungmarken werden ben tigt wenn mittels der Batchdatei eine
79. idet bei DOS Befehlen grunds tzlich zwischen internen und externen Befehlen Interne Befehle sind Bestandteil der Shell selbst wahrend externe Befehle als eigene Programme vorliegen Die DOS Befehle die interessant fiir die Batch Programmierung sein k nnten sind im Folgenden aufgelistet 2 1 assoc Mit Hilfe dieses Befehls kann man die Dateierweiterungen bearbeiten bzw anzeigen lassen assoc dateiendung Dateibeschreibung 2 2 attrib ndert das Dateiattribut M glich sind schreibgesch tzt 1 r versteckt h h und archiv a a 2 3 cacls Andert die Rechte Access Controll List auf NTFS Partitionen oder zeigt diese an cacls x E T G Bob C F gt beispielsweise dem User Bob das Recht ndern f r alle Dateien und Ord ner im aktuellen und allen Unterordnern hinzu Achtung Standardm ig werden Rechte ersetzt Wichtige DOS Kommandos 2 4 cd chdir Uber den cd oder chdi r Befehl change directory kann das aktuelle Verzeichnis gewechselt werden Beachte Nach dem cd folgt ein Leerzeichen das bei nachfolgendem oder je nach Betriebssystemversion weggelassen werden darf Wird der Befehl ohne Parameter ausgefiihrt so wird der Pfad des aktuellen Verzeichnisses ausgegeben relative Angaben Die Eingabe von cd wechselt in das n chsth here Verzeichnis cd zwei Ebenen hoher usw Die Eingabe von cd ORDNERNAME wechselt in den Unterordner ORDNE
80. ie Spr nge helfen mit dem verwendeten Druckprozessor im Windows Druckertreiber Zum Umschalten zun chst die Drucker bersicht ffnen Zu finden unter StartIDrucker und Faxger te Dann die Eigenschaften des gew nschten Druckers ausrufen RechtsklicklEigenschaften Auf dem Reiter Erweitert den Button Druckprozessor klicken In dem erscheinenden Dialogfeld gibt es 2 Felder mit Eintr gen Im rechten Feld Standartdatentypen findet sich neben verschiedenen anderen auch der Eintrag Text Diesen markieren und dann alles mit OK wieder schlie en Der Druckprozessor von Windows ist nun in der Lage Ausgaben entsprechend zu Interpretieren und dem GDI Drucker als Grafik zu liefern Es k nnen aber nur stur 80 Zeichen maximal auf ca 60 Zeilen verteil werden Manchmal sind es bis zu 66 Zeilen 8 0 12 Copy Kopieren von Dateien Der Befehl copy test txt c temp kopiert die Datei test txt aus dem aktuellen Ordner in den Ordner c temp Der Befehl copy c test txt c temp kopiert die Datei test txt aus dem Ordner c in den Ordner c temp Datei und Pfadnamen mit Sonderzeichen hier das Leerzeichen sowie OLIH m ssen beim Copy Kommando und den meisten anderen 80 NET Kommandos in doppelten Anf hrungszeichen angegebenen werden zum Beispiel copy f Beispiel cmd c Dokumente und Einstellungen Siegfried Eigene Dateien Wie man sieht kann man beide Schreibweisen mis
81. igt die Dateitypen an die bei den Zuordnungen f r die entsprechenden Dateierweiterungen verwendet werden bzw ndert sie Zeigt unter Windows XP SP2 die Mac Adresse an Setzt den Windows Befehlsinterpreter auf eine markierte Zeile in einem Batchprogramm Erm glicht Windows Sonderzeichen im Grafikmodus anzu zeigen Zeigt Hilfeinformationen zu Windows Befehlen an Verarbeitet Ausdr cke in einer Batchdatei abh ngig von Bedingungen Erstellt ndert oder l scht die Bezeichnung eines Volumes Erstellt ein Verzeichnis Erstellt ein Verzeichnis Konfiguriert ein Systemger t Zeigt Ausgabe auf dem Bildschirm seitenweise an Verschiebt ein oder mehrere Dateien von einem Verzeichnis in ein anderes Liste aller internen und externen Befehle entspricht der Ausgabe des Befehls help unter Windows XP NET USE PATH PAUSE POPD PRINT PROMPT PUSHD RD RECOVER REM REN RENAME REPLACE RMDIR SET SETLOCAL SHIFT SORT START SUBST TASKLIST TASKKILL TIME TITLE TREE TYPE Verbindet einen Computer mit einer freigegebenen Ressource oder trennt die Verbindung und zeigt Informationen tiber die Verbindungen eines Computers an Der Befehl steuert au erdem st ndige Netzwerkverbindungen Legt den Suchpfad f r ausf hrbare Dateien fest oder zeigt diesen an H lt die Ausf hrung einer Batchdatei an und zeigt eine Mel dung an Wechselt zu dem Verzeichnis das durch PUSHD gespeichert wurde Druckt eine T
82. ims tokens 7 f in reg query SRegHotfixListe do set HotFixNr CALL Anzeigen echo echo pause goto eof Anzeigen reg query SRegHotfixListe SHotFixNr s v Installed FIND 0x1 gt NUL if SerrorlevelS 0 set installiert ja call KB_Info ELSE set installiert nein echo HotFixNr Ist Installiert Sinstalliert if not SInstalledBys echo SHotFixNr installiert von InstalledBy if not SInstalledDates echo HotFixNr am InstalledDate echo goto eof KB_Info set InstalledBy for F tokens 3 c in reg query RegHotfixInfo HotFixNr v InstalledBy 2 gt NUL FIND InstalledBy do set InstalledBy c set InstalledDate for F tokens 3 c in reg query RegHotfixInfo HotFixNr v InstalledDate 2 gt NUL FIND InstalledDate do set InstalledDate c goto eof 8 0 11 Printdateien direkt an den Drucker senden Sendet einzelne Druckdateien an im Netzwerk freigegebene Drucker Eignet sich besonders bei Standard Drucksprachen wie Postscript und HPGL 2 echo off rem pl bat sendet einzelne Druckdateien an bel Drucker direkt rem eignet sich besonders bei Standard Drucksprachen wie Postscript und HPGL 2 78 NET rem Laesst sich in Windows bequem einbinden z B rechte Maustaste Senden an Plotter voreingestellt set server 192 168 0 5 rem server IP von Printserver oder Name von Freigaberechner set druckerbeschreibung 192 168 0 5 Freigabename
83. in Editor ge ffnet zum Beispiel zum Bearbeiten von Batch oder Textdateien 2 14 exit Beendet die Eingabeaufforderung kehrt zu Windows zuriick 2 15 find Mit dem Befehl find kann auch in mehreren Dateien nach einer Zeichen folge gesucht werden Auch find kann mit Parametern gesteuert werden find i ignoriert Gro Kleinschreibung beim Suchbegriff find v Zeigt alle Zeilen an die die Zeichenfolge NICHT enthalten find c Zeigt nur die Anzahl der die Zeichenfolge enthaltenden Zeilen an find n Zeigt die Zeilen mit ihren Zeilennummern an 2 16 format Formatiert die Festplatte oder Diskette Mit format c wird die Festplatte c forma tiert Mit format a wird die Diskette im Laufwerk a formatiert Mit format c s bzw format a s kann man die Festplatte Diskette mit Systemdateien formatieren so dass sie nachher bootf hig sind 2 17 help Die Hilfe Funktion steht in allen Windows Systemen au er Win9X d h 95 98 ME zur Verf gung Der allgemeine Befehl hierzu lautet help Als Aus gabe wird eine Liste mit einem Teil der verf gbaren Kommandozeilen Befehle ausgegeben Diese Listen umfasst den Befehlsnamen linke Spalte und eine Be schreibung rechte Spalte Soll ein Befehl genauer erkl rt werden so lautet die Eingabe help BEFEHLSNAME oder auch BEFEHLSNAME Diese Eingabe in die Kommandozeile f rdert detaillierte Informationen und z T auch Beispiele zu einem Befehl zu Tage Es werden jedoch nicht alle Befehle die es i
84. ing de shellscripting html s 5fb492fd4b515b0c880795a6a7d92ef5c4aed29c 95 WebLinks e http home mnet online de horst muc maind htm Eine Sammlung von Zusatz tools fiir Batch Skripter e http www axel hahn de axel page_compi bat_index htm Viele weitere Infor mationen und Tools zum Thema e http www script example com themen Windows_Batch php Batch Dateien erstellen f r absolute Beginner 11 1 1 Tutorials Batch for Runaways Part I Tutorial Batch I Batch for Runaways Part II gt Tutorial Batch II Batch for Runaways Part III Tutorial Batch III Die For Schleife Tutorial FOR Variablen Tutorial Umgebungsvariablen 11 1 2 Referenzen Microsoft Technet Microsoft Technet en e Microsoft Technet Windows Server 2003 Befehlszeilenreferenz de e Microsoft Technet Windows XP Command line reference A Z en Windows Server 2008 Command Reference en Windows Vista Command Line Tools Technical Reference 11 http home mnet online de horst muc maind htm 12 http www axel hahn de axel page_compi bat_index htm 13 http www script example com themen Windows_Batch php 14 http www administrator de Workshop_Batch_for_Runaways_ _ Part_I_ _Beispiel_FindLongPath Bat_Bedenklich_lange_Pfade_ finden html 15 http www administrator de Workshop_Batch_for_Runaways_ _ Part_II_ __Ein_bisschen_Handwerkszeug
85. ion Moreover your license from a particular copyright holder is re instated permanently if the copyright holder notifies you of the violation by some reasonable means this is the first time you have received notice of violation of this License for any work from that copyright holder and you cure the violation prior to 30 days after your receipt of the notice Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License If your rights have been terminated and not permanently reinstated receipt of a copy of some or all of the same material does not give you any rights to use it 10 FU TURE REVISIONS OF THIS LICENSE The Free Software Foundation may publish new revised versi ons of the GNU Free Documentation License from time to time Such new versions will be similar in spirit to the present versi on but may differ in detail to address new problems or concerns See http www gnu org copyleft Each version of the License is given a distinguishing version number If the Document specifies that a particular numbered version of this License r any later version pplies to it you ha ve the option of following the terms and conditions either of 4 Combined Works You may convey a Combined Work under terms of your choice that taken together effectively do not restrict modification of the portions of the Library contained in the Combined W
86. ir Befehl hat zahlreiche Optionen e b Nur der Dateiname wird ausgegeben Die Ausgabe aller weiteren Infor mationen wie beispielsweise Datum Gr e oder Datentr gerbezeichnung wird unterdr ckt e c Die Dateigr e wird mit einem Punkt als Trennzeichen zwischen jeweils drei Dezimalstellen angegeben also beispielsweise 343 232 Standardeinstellung Soll dies unterdr ckt werden geben Sie als Option c an e p Bei jedem Seitenumbruch wird die Ausgabe unterbrochen bis der Anwender eine Taste dr ckt e on Gibt das Verzeichnis alphabetisch sortiert aus e w Mehrere Eintr ge in einer Zeile werden angezeigt e ah Versteckte Dateien werden angezeigt e a Alle versteckten und System Dateien werden angezeigt e s Zeigt auch den Inhalt der Unterverzeichnisse an Mit dem Befehl dir Dateiname ist es auch m glich Dateien im aktuellen Verzeichnis zu suchen Alternativ kann auch der Platzhalter x bspw dir x x verwendet werden um nach bestimmten Dateien zu suchen Mit dir werden nur Objekte ohne Dateinamen Erweiterung angezeigt In der Regel haben Ordner keine Erweiterung und Dateien eine Erweiterung In diesem Fall werden nur Ordner angezeigt Ordner werden im DOS mit vor dem Ordnernamen gekennzeichnet 2 12 1 Kombinationen dir w o s p durchsucht den aktuellen Pfad inklusive Unterordner nach einer Datei und stellt das Ergebnis seitenweise dar 10 edit 2 13 edit Mit edit wird e
87. it man der Titel Zel besser verfolgen kann ping n 1 localhost gt NUL 64 7 Netzwerkumgebung 7 1 ping Kann verwendet werden um die Verbindung zu einem anderen Rechner zu testen Wenn die Gegenseite antwortet werden Informationen tiber die IP Nummer und zur Verbindungsqualit t angezeigt Zu beachten ist dabei dass aus einer ausblei benden Antwort nicht zwangsl ufig auf einen missgliickten Verbindungsversuch geschlossen werden darf manche Administratoren unterbinden diese Art Test aus Sicherheitsgrinden Beispiel C gt ping de wikibooks org Ausgabe Ping rr knams wikimedia org 145 97 Antwort von 145 97 39 155 Bytes 32 Antwort von 145 97 39 155 Bytes 32 Antwort von 145 97 39 155 Bytes 32 Antwort von 145 97 39 155 Bytes 32 Ping Statistik f r 145 97 39 1553 Pakete Gesendet 4 Empfangen Ca Zeitangaben in Millisek Minimum 34ms Maximum 67ms e gt 39 155 mit 32 Bytes Daten Zeit 67ms Zeit 35ms Zeit 34ms Zeit 39ms TTL 57 TTL 57 TTL 57 TTL 57 4 Verloren 0 0 Verlust Mittelwert 43ms Hinweis Dies lasst sich durch einen Trick mit dem find Befehl auch automatisieren ping de wikibooks org find TTL goto hostnotfound 65 Netzwerkumgebung 7 2 ipconfig e Durch den Parameter help erh lt man kurze Hilfe e Der Aufruf des Befehls ipconfig ohne Parameter teilt die eigene IP Adresse mit e Durch den Befeh
88. ith none of the additional permissions of this License applicable to that copy 3 Object Code Incorporating Material from Library Header Files The object code form of an Application may incorporate ma terial from a header file that is part of the Library You may convey such object code under terms of your choice provided that if the incorporated material is not limited to numerical pa rameters data structure layouts and accessors or small macros inline functions and templates ten or fewer lines in length you do both of the following a Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License b Accompany the object code with a copy of the GNU GPL and this license document aggregate which are not themselves derivative works of the Do cument If the Cover Text requirement of section 3 is applicable to these copies of the Document then if the Document is less than one half of the entire aggregate the Document s Cover Texts may be placed on covers that bracket the Document within the ag gregate or the electronic equivalent of covers if the Document is in electronic form Otherwise they must appear on printed covers that bracket the whole aggregate 8 TRANSLATION Translation is considered a kind of modification so you may distribute translations of the Document under the terms of sec tion 4 Replacing Invariant Sections with
89. ivecommons org licenses by cc by 2 0 Creative Commons Attribution 2 0 License h creativecommons org licenses by 2 cc by 2 0 Creative Commons Attribution 2 0 License h creativecommons org licenses by 2 cc by 2 5 Creative Commons Attribution 2 5 License h creativecommons org licenses by 2 cc by 3 0 Creative Commons Attribution 3 0 License h creativecommons org licenses by 3 sa 1 0 0 0 deed en 5 deed en 0 deed en GPL GNU General Public License ht licenses gpl 2 0 txt tp www gn LGPL GNU Lesser General Public License ht licenses lgpl html PD This image is in the public domain tp www gn ttp ttp ttp ttp u org u org ATTR The copyright holder of this file allows anyone to use it for any pur pose provided that the copyright holder is properly attributed Redistribution derivative work commercial use and all other use is permitted 101 Abbildungsverzeichnis EURO This is the common reverse face of a euro coin The copyright on the design of the common face of the euro coins belongs to the European Commission Authorised is reproduction in a format without relief drawings paintings films provided they are not detrimental to the image of the euro LFK Lizenz Freie Kunst http artlibre org licence lal de CFR Copyright free use EPL Eclipse Public License http www eclip
90. k nnen Sie zudem leere Zeilen ausgeben Beispiel Inhalt echo off echo Jetzt gibt es 3 Leere Zeilen zu sehen echo echo echo echo So Da waren sie Ausgabe Jetzt gibt es 3 Leere Zeilen zu sehen So Da waren sie 4 Kapitel 3 17 auf Seite 37 24 ECHO 3 9 1 Benutzereingaben mit ECHO Mit Hilfe des echo Befehls k nnen Sie auch in einem Skript Benutzereingaben simulieren indem Sie den Pipe Operator verwenden Beispiel Uhrzeit anzeigen ohne Nachfrage Das normale Verhalten des t ime Befehls ist die aktuelle Zeit der verwendeten Systemuhr anzuzeigen und in der n chsten Zeile die Eingabe einer neuen Uhrzeit zu erwarten Dr ckt man auf Enter bleibt die Systemzeit unver ndert Will man die Zeit nur anzeigen lassen z B in einer Batchdatei vor und nach einer Befehlsfolge um zu messen wie lange der PC daf r braucht l sst sich die Bet tigung der Enter Taste durch einen entsprechenden echo Befehl ersetzen echo time ber den Pipe Mechanismus l sst sich dar ber hinaus die Zeile Geben Sie die neue Uhrzeit ein unterdr cken echo time find v neue Dabei ist die Gro Kleinschreibung von neue zu beachten oder der Schalter I zu verwenden denn find ist case sensitiv Diese Beispiele dienen allerdings nur zur Demonstration denn die Zeitausgabe w re auch ohne Pipes aber erst ab Windows 2000 m glich mit time t oder einfach echo S times Sehr n tzlich ist das echo Pipi
91. l in dem sich der Wert LastKey befindet LastKey wird mittels reg add in die Registry eingespielt und danach wird regedit gestartet Das Ganze funktioniert allerdings nur wenn regedit exe noch nicht l uft Und hier noch eine kleine Batchdatei um mit regedit exe Werte aus der Registry auszulesen set Key HKEY_CURRENT_USER Software Microsoft Windows CurrentVersion Applets Regedit regedit exe e c temp inhalt reg Key Achtung Die Datei inhalt reg ist im Unicode Format Ein Tipp dazu Der type Befehl kann Unicode lesen 8 0 3 TaskList Abfrage Eine Routine um das Laufen eines Prozesses mittels tasklist exe festzustellen In diesem Beispiel wird gepr ft ob Prozess exe l uft 75 Beispiele echo off set ProgEXE Prozess exe set tempdatei temp TempDatei txt tasklist FI IMAGENAME eq ProgEXE FO CSV gt tempdatei for F skip 2 tokens 1 delims f in tempdatei do echo gefiltert E if S f SProgEXES echo Prozess ProgEXE l uft goto ende echo Prozess ProgEXE l uft nicht goto ende ende del tempdateis Alternativ ohne obige tempor re Datei tempdatei zu ben tigen kann man bei spielsweise unter Windows XP folgendes verwenden TaskList FI IMAGENAME eq ProgEXE 2 gt NUL Find SProgEXE gt NUL IF ERRORLEVEL ECHO NOT Running GOTO Ende ELSE ECHO Running GOTO Ende 8 0 9 Dienste einrichten echo off prompt G echo echo Manuelle
92. l ipconfig l sst sich die IP Adresse von Netzwerkverbindungen Ethernetkarten verwalten Beispiel C gt ipconfig Ausgabe windows IP Konfiguration Ethernetadapter VMware Network Verbindungsspezifisches IP Adresse Subnetzmaske Standardgateway Adapter VMnet8 DNS Suffix 192 168 0 1 255 258 2255 0 192 168 0 11 Ethernetadapter VMware Network Verbindungsspezifisches IP Adresse Subnetzmaske Standardgateway Ethernetadapter LAN Verbindung Verbindungsspezifisches IP Adresse Subnetzmaske Standardgateway Adapter VMnetl DNS Suffix 2 192 1 08 52 5T 29525572050 192 168 2 11 3 DNS Suffix myhost local 192416851 1 209 230425950 192 2683 Lo LL 7 2 1 ipconfig all Eine detailliertere Auskunft erh lt man mit dem Parameter all Beispiel 66 ipconfig C gt ipconfig all Ausgabe Windows IP Konfiguration Hostname so lee N cestmoi Prim res DNS Suffix mypc local KnotentyP 3 Unbekannt IP Routing aktiviert Nein WINS Proxy aktiviert Nein DNS Suffixsuchliste mypc local mypc local Ethernetadapter VMware Network Adapter VMnet8 Verbindungsspezifisches DNS Suffix Beschreibung VMware Virtual Ethernet Adapter for VMnet 8 Physikalische Adresse 01 23 45 67 89 AB DHCP aktiviert 4 4 X Nein PEO AOR Sse 5 le Te ie Te ie a
93. laufe ich mit niedriger Priorit t echo berpr fe es im Taskmanager pause Funktionsweise Das Prinzip ist eigentlich ganz einfach Wenn kein Parameter bergeben wird wird angenommen da die Batchdatei zum ersten mal gestartet wurde Die if 1 Bedingung ist also erf llt Mittels start wird dann diesel be Batchdatei mit ver nderter Priorit t gestartet allerdings mit einem angeh ngten Parameter weiter_machen K nnte auch irgendwas anderes sein Somit ist beim n chsten Aufruf die if 1 Bedingung nicht mehr erf llt und der normale Teil der Batchdatei wird abgearbeitet Wenn man der Batchdatei einen Parameter bergeben m chte z B ein Dateiname o muss man alle Parameter verschieben echo off if 2 start WAIT LOW B cmd exe V C s0 1 weiter_machen goto eof echo Jetzt laufe ich mit niedriger Priorit t o echo Nun kann 1 bearbeitet werden pause Anmerkungen Normalerweise k nnte man statt s0 auch 70 bei der cmd exe Zeile verwenden Allerdings klappt das nicht richtig wenn Leerzeichen in der 60 Ausgaben in eine Variable umleiten Batch Datei vorhanden sind Mit sO wird der komplette Pfad zur Batchdatei als Kurznamen angegeben In dem Pfad kommt dann keine Leerzeichen vor 6 0 12 Probleme mit Variablen Wenn man sich die Hilfeseiten zu set mittels set durchliest st t man auf das Thema verz gerte Erweiterung von Variablen Das will ich hier
94. ll kann man eine andere Batch Datei aufrufen Sobald diese beendet wurde wird die urspr ngliche Batchdatei weiter ausgef hrt Beispiel REM Call cmd echo off echo Diese Batchdatei ruft eine andere auf call anderedatei bat pause REM anderedatei bat echo off echo Die andere Datei Die Ausgabe wenn man die Datei Call cmd startet Diese Batchdatei ruft eine andere auf Die andere Datei Pause Wenn die Befehlserweiterungen aktiviert sind Standard ab Windows 2000 kann man auch Sprungmarken aufrufen und auch Parameter bergeben Beispiel echo off REM Diese Batchdatei ruft eine eigene Sprungmarke auf echo Vor dem Sprung call sprungmarke 19 Batch Befehle echo Nach dem Sprung pause goto end sprungmarke echo Sprungmarke aufgerufen goto eof EOF f hrt nicht zum unsichtbaren Ende der Batch Datei wie oben beschrieben sondern f hrt die Batch Datei nach dem Aufruf der Sprungmarke fort send exit Die Ausgabe Vor dem Sprung Sprungmarke aufgerufen Nach dem Sprung Beispiel mit Parameter echo off REM Diese Batchdatei ruft eine eigene Sprungmarke auf echo Vor dem Sprung call sprungmarke meinParameter echo Nach dem Sprung pause goto end sprungmarke echo Sprungmarke aufgerufen und Parameter 1 uebergeben goto eof send exit Die Ausgabe Vor dem Sprung Sprungmarke aufgerufen und Parameter meinParameter uebergeben Nach dem Sprung goto eof Dieser Befehl
95. m DOS gibt angezeigt 2 18 ipconfig Informationen ber die Windows IP Konfiguration Der ipconfig Befehl hat folgende Optionen 2 http de wikibooks org wiki Batch 11 Wichtige DOS Kommandos e all Zeigt zus tzliche Details e release Gibt die zugeteilte IP Adresse zur ck e renew Bezieht eine neue IP Adresse 2 19 keyb L dt Tastaturtreiber keyb gr c dos keyboard sys l dt den deutschen Tastaturtrei ber keyboard sys muss sich im Verzeichis c dos befinden 2 20 loadhigh L dt Programme in freie UMB Upper Memory Blocks 2 21 md Der Befehl md make directory legt ein neues Verzeichnis an 2 22 more Mit der Ausgabeumleitung more bspw type Dateiname more wird bei Seitenwechsel zur Best tigung aufgefordert Damit besteht die M glichkeit ber mehrere Seiten f hrende Dokumente anzu zeigen more ist der einzige Befehl bei der auch in der DOS Welt die sogenannte Pipe verwendet wird Bei der Pipe handelt es sich um das Zeichen Mit diesem Zeichen ist es m glich zwei Befehle miteinander auf eine spezielle Weise zu verbinden Dabei wird der erste Befehl ausgef hrt seine Ausgaben werden jedoch nicht auf den Bildschirm geschrieben sondern in einen Puffer Der zweite Befehl wird auf eine Weise gestartet dass er seine Eingaben nicht von der Tastatur sondern von ebendiesem Puffer bekommt Mit more ist es ebenfalls m glich den Inhalt einer Datei an eine andere
96. me 5 6 1 Beispiel ECHO OFF ECHO sdate gt _ txt SET P tmp lt _ txt ECHO Das Datum heute ist tmp e siehe auch Net Befehle 3 Kapitel 7 5 auf Seite 69 52 6 Programmierungshilfen 6 0 2 Andern des Editors zum Bearbeiten von Batchdateien Wenn man im Windows Explorer mit der Rechten Maus Taste RMT auf eine bat klickt so werden einem die Befehle Offnen und Bearbeiten angeboten ffnen f hrt die Batchdatei aus Mit dem Befehl Bearbeiten wird die Batchdatei in den Texteditor notepad exe zum Bearbeiten ge ffnet Auch wenn Notpad zum Bearbeiten von Batchdateien ausreicht so m chte man h ufig doch die Batchdateien mit einem anderen komfortableren Editor bearbeiten der z B Syntaxhervorhebung Syntaxhighlighting beherrscht Um einen anderen Editor z B Syn zu verwenden muss man in der Registry an der Stelle HKEY_CLASSES_ROOT bat file shell edit command den Standard Wert Standard SystemRoot System32 NOTEPAD EXE 1 auf den Startbefehl des entsprechenden Editors ndern Z B HKEY_CLASSES_ROOT batfile shell edit command Standard c Programme Editor syn syn exe 1 1 http syn sourceforge net 53 Programmierungshilfen 6 0 3 Datum und Uhrzeit anzeigen F r Log Dateien ist es wichtig dass man die Logeintr ge mit Datum und Uhrzeit versehen kann echo date 0 Stime 0 8 Uhr Ergebnis 11 09 2010 15 5
97. n tigt werden und diese nicht oder falsch angegeben wurden so wird der Benutzer nach diesen gefragt Es kann auch nur ein Benutzer angegeben werden indem das Passwort durch einen Asterisk ersetzt wird 69 Netzwerkumgebung Die Eingabe von NET USE ohne Parameter zeigt bereits verbundene Laufwerke an Bei Windows Freigaben wird auch ein Status angezeigt bei Samba Freigaben jedoch nicht 7 5 2 NET SEND Nachrichten an andere Rechner senden Mit NET SEND k nnen kurze Nachrichten an andere Rechner geschickt wer den Der Empf nger sieht diese dann normalerweise in einer Message Box Die Benutzung empfiehlt sich nur bedingt da moderne Firewalls solche Nachrichten normalerweise blocken siehe Hinweis unten Syntax NET SEND Empf nger Nachricht Empf nger kann dabei sein IP Adresse Domain e Domain mit Benutzerangabe domain name e Rechnername im lokalen Netzwerk Benutzername im lokalen Netzwerk e Asterisk f r alle erreichbaren lokalen Rechner Hinweis Da NET SEND leider sehr oft f r Spam missbraucht wird wurde empfiehlt es sich es abzuschalten Dies geschieht ber den Windows Service Nachrichten dienst Dadurch k nnen weder Nachrichten gesendet noch empfangen werden NET STOP Messenger 7 5 3 NET START Startet Windows Dienste Syntax NET START Dienstname Entweder Messenger oder Nachrichtendienst je nach Regions Spracheinstellungen Die Eingabe von N
98. n cmd c 0 S amp set amp goto eof Anmerkung Sollte die Command Processor Option DelayedExpansion in der Re gistry aktiviert sein siehe unter Hilfe cmd l sst sich ein als Variablenname nicht verwenden In diesem Fall bzw sinnvollerweise immer den Variablennamen ndern auf x oder y oder oder Beispiel 3 http www google de url sa t amp source web amp ct res amp cd 1 amp ved 0CAgOF jJAA amp url http 3A32F 2Fwww microsoft com 2Fdownloads 2Fdetails aspx 3FFamilyID 3D9D467A69 57FF 4AE7 96EE B18C47 90CFFD amp rct j amp q mst resourcetkit amp ei SEtGS 8H6FYfM Qai2tRt amp usg AFOjJCNEUL30wz1C_ 161SalBsG99a7Lcecrg 4 http groups google co uk group alt msdos batch nt msg d11e951a822bc420 dmode source T 59 Programmierungshilfen set set l start S dpnx0 min cmd c 0 S amp set amp goto eof 6 0 11 Mittels start LOW die Priorit t festlegen Manchmal ist es hilfreich wenn die Batchdatei mit einer niedrigen Priorit t l uft Das kann man mittels start LOW erreichen Weitere Optionen sind NORMAL HIGH REALTIME ABOVENORMAL und BELOWNORMAL Das Beispiel zeigt wie eine Batchdatei quasi sich selber in die niedrige Priorit t versetzten kann In dem Fall klappt es allerdings nur wenn beim ersten Start kein Parameter bergeben wurde echo off if 1 start WAIT LOW B cmd exe V C s0O weiter_machen goto eof echo Jetzt
99. nd 11 http de wikibooks org w index php title Benutzer Creibens 12 http de wikibooks org w index php title Benutzer Daniel_B 13 http de wikibooks org w index php title Benutzer Der_Leo 14 http de wikibooks org w index php title Benutzer Dirk_ Huenniger 15 http de wikibooks org w index php title Benutzer DonQuichot 97 Autoren 1 Enix 2 Emes2k 1 Enomil 1 EF Fjodor 2 Fehlerkorrektur 2 Flominator 21 Genrich 4 Global6672 1 Haddock 1 Hardy42 5 Heuler067 4 Hijherbert 2 Jaho489678 2 Jan 1 Joddel 7 Johanna31 gt 17 Juetho 1 Klartext 16 Klaus Eifert 1 Kleidersack gt 16 http de wikibooks org w index 29 17 http de wikibooks org w index 18 http de wikibooks org w index 19 http de wikibooks org w index _Fjodor 20 http de wikibooks org w index Fehlerkorrektur 21 http de wikibooks org w index 22 http de wikibooks org w index 23 http de wikibooks org w index 24 http de wikibooks org w index 25 http de wikibooks org w index 26 http de wikibooks org w index 27 http de wikibooks org w index 28 http de wikibooks org w index 29 http de wikibooks org w index 30 http de wikibooks org w index 31 http de wikibooks org w index 32 http de wikibooks org w index 33 http de wikibooks org w index 34 http de wikibooks org w index Eifert 35 http de wikibooks org w index 98 OO O tOs
100. ndem Trick umgehen echo off Autobefehlsanzeige ausgeschaltet ver gt TMP dat speichert die Ausgabe des Befehls in der Datei IMP dat Set p ver lt TMP dat definiert die Variable des Betriebssystems NUH TEMPORAR echo Sver gibt nun die definierte Variable aus pause gt nul pause Niitzliche Stringoperation fiir Variablen 37 Batch Befehle Teilstring Syntax var n m Ergibt den Teilstring von var beginnend mit dem n ten Zeichen von links und einer L nge von m Zeichen Gez hlt wird ab 0 d h das erste Zeichen hat die Position 0 und nicht 1 Werden negative Werte verwendet so wird vom Ende des Strings von rechts nach links gez hlt Beispiel Inhalt set str myfile bat set name str 0 6 echo Sname In diesem Beispiel wird der Teilstring von str vom ersten Zeichen an mit einer L nge von 6 Zeichen ausgegeben Ausgabe myfile Stringsubstitution Syntax var strl str2 Mithilfe des Syntax var strl str2 kann die Zeichenkette str1 des Inhalts der Variable var durch str2 ersetzt werden Beispiel Inhalt set str mycommand p m file echo str set str str p m t echo str In diesem Beispiel werden die Optionen p m des Befehls mycommand durch die Option t ersetzt Ausgabe mycommand p m file mycommand t file 38 Variablen Benutzereingaben in Variablen speichern Um eine Benutzereingabe in eine Variable speichern zu k nnen wird
101. ng auch zur bergabe von Benutzereingaben welche von einzelnen Befehlen abgefragt werden Beispiel berpr fung einer Festplatte chkdsk es JE fe kann da es sich beim Laufwerk C um das Systemlaufwerk handelt erst nach einem Systemstart ausgef hrt werden Normalerweise m sste der Benutzer deswegen den Systemstart durch Eingabe von Y best tigen Diese Aktion kann man in einem Batch so abbilden echo y chkdsk c r 25 Batch Befehle 3 10 FOR Erm glicht die Schleifenbearbeitung Syntax for Variable in Satz do Befehl Parameter Interner Befehl Ab MS DOS bis Windows NT 6 1 Windows 7 Beispiel Zeigt alle Dateien im Verzeichnis temp an Es werden nur Dateien keine Ver zeichnisse angezeigt Um Verzeichnisse anzuzeigen siehe Liste der FOR Optionen unten Der Parameter R bewirkt dass alle Unterverzeichnisse mit einbezogen werden Rekursive Schleife ACHTUNG Die Variable darf nur aus einem Buchstaben bestehen t ist erlaubt test nicht Bei der Verwendung mehrerer Befehle muss zwischen DO und der Klam mer ein Leerzeichen sein Falsch for Variable in Satz do RICHTIG for Variable in Satz do Befehll Befehl2 Inhalt echo off for R temp f in x x do echo f REM Den Befehl k nnte man auch einzeilig schreiben pause 26 FOR Ausgabe Alle Temp Dateien Bitte beliebige Taste dr cken Z hlschleifen Mit solchen Sc
102. nn man mit einem zus tzlichen 2 gt amp 1 die Ausgaben von stderr auf stdout umleiten Da stdout dann nach NUL verschoben wird sieht man absolut nichts MeinProgramm exe gt NUL 2 gt amp 1 6 0 14 Professionelle Message Fenster erzeugen Bisher konnte man in Batch keine Fenster erzeugen bzw nur in Windows XP mithilfe des Windows Nachrichtendienstes Doch der ist f r Anwendungen viel zu unpraktisch da man nicht einmal den Fenstertitel bestimmen kann und au erdem ist dieser unter Vista oder Windows 2000 nicht verf gbar Ich habe jedoch ein kleines Schlupfloch gefunden mit dem man dennoch Fenster erzeugen kann echo off Echo msgbox Text 0 Fenstername gt Test vbs ping localhost n 3 w 1000 gt NUL start Test vbs pause Erkl rung Man erzeugt hier mithilfe des Umleitungssymbols Eng pipe gt einen Tempor ren VBScript der in der Lage ist ein Messagefenster zu erzeugen Dies sorgt in Anwendungen f r mehr bersicht und Professionalit t 62 Ausgaben in eine Variable umleiten 6 0 15 Falls das nicht funktioniert Falls statt eures Textes die Meldung Der Zugriff auf den Windows Scripthost ist auf diesem Computer deaktiviert erscheint dann ist das Offnen von VBscripts und JScripts aus Sicherheitsgriinden verboten Um das zu ndern ffnet ihr den Windows Registrierungseditor regedit exe und l scht NUR folgenden Wert HKey_Local_Machine Software Microsoft WindowsScriptHost Enabled dann diirf
103. of the Program s source code as you receive it in any medium provided that you conspi cuously and appropriately publish on each copy an appropriate copyright notice keep intact all notices stating that this License and any non permissive terms added in accord with section 7 apply to the code keep intact all notices of the absence of any warranty and give all recipients a copy of this License along with the Program You may charge any price or no price for each copy that you convey and you may offer support or warranty protection for a fee 5 Conveying Modified Source Versions You may convey a work based on the Program or the modifica tions to produce it from the Program in the form of source code under the terms of section 4 provided that you also meet all of these conditions a The work must carry prominent notices stating that you mo dified it and giving a relevant date b The work must carry prominent notices stating that it is released under this License and any conditions added under section 7 This requirement mo difies the requirement in section 4 to keep intact all notices c You must license the entire work as a whole under this License to anyone who comes into possession of a copy This License will therefore apply along with any applicable section 7 additional terms to the whole of the work and all its parts regardless of how they are packaged This License gives no per mission to license
104. of the benefit of the patent license for this par ticular work or 3 arrange in a manner consistent with the re quirements of this License to extend the patent license to down stream recipients Knowingly relying means you have actual knowledge that but for the patent license your conveying the covered work in a country or your recipient s use of the cover ed work in a country would infringe one or more identifiable patents in that country that you have reason to believe are valid If pursuant to or in connection with a single transaction or ar rangement you convey or propagate by procuring conveyance of a covered work and grant a patent license to some of the parties receiving the covered work authorizing them to use pro pagate modify or convey a specific copy of the covered work then the patent license you grant is automatically extended to all recipients of the covered work and works based on it A patent license is discriminatory if it does not include wi thin the scope of its coverage prohibits the exercise of or is conditioned on the non exercise of one or more of the rights that are specifically granted under this License You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software under which you make payment to the third party based on the extent of your activity of conveying the work and under which the third party gr
105. of the network or violates the rules and protocols for communication across the network Corresponding Source conveyed and Installation Information provided in accord with this section must be in a format that is publicly documented and with an implementation available to the public in source code form and must require no special password or key for unpacking reading or copying 7 Additio nal Terms Additional permissions are terms that supplement the terms of this License by making exceptions from one or more of its con ditions Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License to the extent that they are valid under applicable law If additional permissions apply only to part of the Program that part may be used separately under those permissions but the entire Program remains governed by this License without re gard to the additional permissions When you convey a copy of a covered work you may at your option remove any additional permissions from that copy or from any part of it Additional permissions may be written to require their own removal in certain cases when you modify the work You may place additional permissions on material ad ded by you to a covered work for which you have or can give appropriate copyright permission Notwithstanding any other provision of this License for mate rial you add to a covered work yo
106. ommands show w and show c should show the appropriate parts of the General Public License Of course your program s commands might be different fora GUI interface you would use an about box You should also get your employer if you work as a pro grammer or school if any to sign a copyright disclai mer for the program if necessary For more information on this and how to apply and follow the GNU GPL see lt http www gnu org licenses gt The GNU General Public License does not permit incorpo rating your program into proprietary programs If your pro gram is a subroutine library you may consider it more use ful to permit linking proprietary applications with the library If this is what you want to do use the GNU Lesser General Public License instead of this License But first please read lt http www gnu org philosophy why not Igp html gt that you add no other conditions whatsoever to those of this Li cense You may not use technical measures to obstruct or con trol the reading or further copying of the copies you make or distribute However you may accept compensation in exchan ge for copies If you distribute a large enough number of copies you must also follow the conditions in section 3 You may also lend copies under the same conditions stated above and you may publicly display copies 3 COPYING IN QUANTITY If you publish printed copies or copies in media that common ly have p
107. ork and reverse engineering for debugging such modifications if you also do each of the following a Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License b Accompany the Combined Work with a copy of the GNU GPL and this license document c For a Combined Work that displays copyright notices during execution include the copyright notice for the Library among these notices as well as a reference directing the user to the copies of the GNU GPL and this license document d Do one of the following o 0 Convey the Minimal Corresponding Source under the terms of this License and the Corresponding Application Code in a form suitable for and under terms that permit the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source o 1 Use a sui table shared library mechanism for linking with the Library A suitable mechanism is one that a uses at run time a copy of the Library already present on the user s computer system and b will operate properly with a modified version of the Library that is interface compatible with the Linked Version e Provide Installation Information but only if you would otherwise be re quired to provide such information under section 6 of the GNU GPL an
108. ows Taskmanager taskeng exe Aufgabenplanungsmodul calc exe Taschenrechner mshta exe Scripthost f r HTA HTML Scripting W CScript exe Beides Bestandteil des Windows Scripthostes f r JS und VBS 36 Variablen iexplore exe Microsoft Windows Internet Explorer Standardbrowser fiir Windows firefox exe Mozilla Firefox Internetbrowser dialer exe Windows Hilfeprogramm fiir DFU Einwahlverbindungen Notepad exe Standard Textbearbeitungsprogramm von Microsoft cmd exe Microsoft Windows Befehlsprozessor fiir Batch winword Microsoft Word 3 17 Variablen Es gibt zweierlei Arten von Variablen Scriptvariablen und Systemvariablen Die Scriptvariablen werden innerhalb von Schleifen eingesetzt beginnen mit und einem frei w hlbaren Zeichen oder einer Zeichenfolge Systemvariablen miissen von begonnen und von abgeschlossen werden Sie sind fest definiert Die Variable 0 hat stets den Namen der aktuellen Datei Die Variable ver hat immer den Namen der aktuellen Betriebssystemversion Unter Windows XP muss os statt over verwendet werden Gibt man unter Windows Vista und 7 den Befehl echo os ein so gibt der Computer die Version des Systems aus auf dem das System basiert Unter Windows Vista und Windows 7 gibt es einen Befehl namen ver mit dem man die Version direkt angezeigt bekommt Es gibt zwar keine direkte Variable bei Vista und Windows 7 die das Betriebssystem definiert jedoch kann man das mit folge
109. per missions However no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version 15 Disclaimer of Warranty THERE IS NO WARRANTY FOR THE PROGRAM TO THE EXTENT PERMITTED BY APPLICABLE LAW EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPY RIGHT HOLDERS AND OR OTHER PARTIES PROVIDE THE PROGRAM AS IS WITHOUT WARRANTY OF ANY KIND EITHER EXPRESSED OR IMPLIED INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICU LAR PURPOSE THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU SHOULD THE PROGRAM PROVE DEFECTIVE YOU AS SUME THE COST OF ALL NECESSARY SERVICING RE PAIR OR CORRECTION 16 Limitation of Liability IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPY RIGHT HOLDER OR ANY OTHER PARTY WHO MODI FIES AND OR CONVEYS THE PROGRAM AS PERMIT TED ABOVE BE LIABLE TO YOU FOR DAMAGES IN CLUDING ANY GENERAL SPECIAL INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM INCLU DING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAI NED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PRO GRAMS EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DA MAGES 17 Interpretation of Sections 15 and 16 Examples of suitable formats for T
110. prominent item in the list meets this criterion 1 Source Code The source code for a work means the preferred form of the work for making modifications to it Object code means any non source form of a work A Standard Interface means an interface that either is an offi cial standard defined by a recognized standards body or in the case of interfaces specified for a particular programming lan guage one that is widely used among developers working in that language The System Libraries of an executable work include anything other than the work as a whole that a is included in the nor mal form of packaging a Major Component but which is not part of that Major Component and b serves only to enable use of the work with that Major Component or to implement a Standard Interface for which an implementation is available to the public in source code form A Major Component in this context means a major essential component kernel window system and so on of the specific operating system if any on which the executable work runs or a compiler used to produce the work or an object code interpreter used to run it The Corresponding Source for a work in object code form me ans all the source code needed to generate install and for an executable work run the object code and to modify the work in cluding scripts to control those activities However it does not include the work s System
111. r hereafter acquired that would be infringed by some man ner permitted by this License of making using or selling its contributor version but do not include claims that would be in fringed only as a consequence of further modification of the contributor version For purposes of this definition control includes the right to grant patent sublicenses in a manner con sistent with the requirements of this License Each contributor grants you a non exclusive worldwide royalty free patent license under the contributor s essential pa tent claims to make use sell offer for sale import and other wise run modify and propagate the contents of its contributor version In the following three paragraphs a patent license is any ex press agreement or commitment however denominated not to enforce a patent such as an express permission to practice a pa tent or covenant not to sue for patent infringement To grant such a patent license to a party means to make such an agree ment or commitment not to enforce a patent against the party If you convey a covered work knowingly relying on a patent license and the Corresponding Source of the work is not avail able for anyone to copy free of charge and under the terms of this License through a publicly available network server or other readily accessible means then you must either 1 cause the Corresponding Source to be so available or 2 arrange to deprive yourself
112. ransparent copies include plain ASCII without markup Texinfo input format LaTeX in put format SGML or XML using a publicly available DTD and standard conforming simple HTML PostScript or PDF de signed for human modification Examples of transparent image formats include PNG XCF and JPG Opaque formats include proprietary formats that can be read and edited only by pro prietary word processors SGML or XML for which the DTD and or processing tools are not generally available and the machine generated HTML PostScript or PDF produced by so me word processors for output purposes only The Title Page means for a printed book the title page itself plus such following pages as are needed to hold legibly the ma terial this License requires to appear in the title page For works in formats which do not have any title page as such Title Pa ge means the text near the most prominent appearance of the works title preceding the beginning of the body of the text The publisher means any person or entity that distributes co pies of the Document to the public A section Entitled XYZ means a named subunit of the Docu ment whose title either is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in another lan guage Here XYZ stands for a specific section name mentio ned below such as Acknowledgements Dedications Endor sements or History To Preserve the Title f such a section when you modify t
113. rinted covers of the Document numbering more than 100 and the Document s license notice requires Cover Texts you must enclose the copies in covers that carry clearly and legibly all these Cover Texts Front Cover Texts on the front cover and Back Cover Texts on the back cover Both covers must also clearly and legibly identify you as the publisher of these copies The front cover must present the full title with all words of the title equally prominent and visible You may add other material on the covers in addition Copying with changes limited to the covers as long as they preserve the title of the Do cument and satisfy these conditions can be treated as verbatim copying in other respects If the required texts for either cover are too voluminous to fit legibly you should put the first ones listed as many as fit rea sonably on the actual cover and continue the rest onto adjacent pages If you publish or distribute Opaque copies of the Document numbering more than 100 you must either include a machine readable Transparent copy along with each Opaque copy or state in or with each Opaque copy a computer network locati on from which the general network using public has access to download using public standard network protocols a comple te Transparent copy of the Document free of added material If you use the latter option you must take reasonably prudent steps when you begin distribution of Opaque copies in quantity to en
114. rs Legt die Hintergrund und Vordergrundfarben f r die Konso le fest Vergleicht den Inhalt zweier Dateien oder S tze von Dateien Zeigt die Komprimierung von Dateien auf NTFS Partitionen an bzw ndert diese Konvertiert FAT Volumes in NTFS Das aktuelle Laufwerk kann nicht konvertiert werden Kopiert eine oder mehrere Dateien an eine andere Stelle Zeigt das Datum an bzw legt dieses fest L scht eine oder mehrere Dateien 91 Referenz DIR DISKCOMP DISKCOPY DOSKEY ECHO ENDLOCAL ERASE EXIT FC FIND FINDSTR FOR FORMAT FTYPE GETMAC GOTO GRAFTABL HELP IF LABEL MD MKDIR MODE MORE MOVE 92 Listet die Dateien und Unterverzeichnisse eines Verzeichnis ses auf Vergleicht den Inhalt von zwei Disketten Kopiert den Inhalt von einer Diskette auf eine andere Disket te Bearbeitet Befehlseingaben ruft Windows Befehle zur ckt und erstellt Macros Zeigt Meldungen an bzw schaltet die Befehlsanzeige ein oder aus Beendet den lokalen G ltigkeitsbereich von Umgebungs nde rungen in einer Batchdatei L scht eine oder mehrere Dateien Beendet das Programm CMD EXE Befehlsinterpreter Vergleicht zwei oder mehr S tze von Dateien und zeigt die Unterschiede an Sucht eine Zeichenkette in einer oder mehreren Datei en Sucht Zeichenketten in Dateien F hrt einen angegebenen Befehl f r jede Datei in einem Dateiensatz aus Formatiert einen Datentr ger f r die Verwendung mit Win dows Ze
115. s with the same name but different contents make the title of each such section unique by adding at the end of it in parentheses the na me of the original author or publisher of that section if known or else a unique number Make the same adjustment to the sec tion titles in the list of Invariant Sections in the license notice of the combined work In the combination you must combine any sections Entitled Historyin the various original documents forming one section Entitled History likewise combine any sections Entitled Ack nowledgements and any sections Entitled Dedications You must delete all sections Entitled Endorsements 6 COLLEC TIONS OF DOCUMENTS You may make a collection consisting of the Document and other documents released under this License and replace the individual copies of this License in the various documents with a single copy that is included in the collection provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects You may extract a single document from such a collection and distribute it individually under this License provided you insert a copy of this License into the extracted document and follow this License in all other respects regarding verbatim copying of that document 7 AGGREGATION WITH INDEPENDENT WORKS A compilation of the Document or its derivatives with other se parate and independent documents or works in or on a vol
116. se org org documents epl v10 php Copies of the GPL the LGPL as well as a GFDL are included in chapter Licenses Please note that images in the public domain do not require attribution You may click on the image numbers in the following table to open the webpage of the images in your webbrower 67 Kapitel 13 auf Seite 105 102 Abbildungsverzeichnis 103 13 Licenses 13 1 GNU GENERAL PUBLIC LICENSE Version 3 29 June 2007 Copyright 2007 Free lt http fsf org gt Software Foundation Inc Everyone is permitted to copy and distribute verbatim copies of this license document but changing it is not allowed Preamble The GNU General Public License is a free copyleft license for software and other kinds of works The licenses for most software and other practical works are designed to take away your freedom to share and change the works By contrast the GNU General Public License is inten ded to guarantee your freedom to share and change all versions of a program to make sure it remains free software for all its users We the Free Software Foundation use the GNU General Public License for most of our software it applies also to any other work released this way by its authors You can apply it to your programs too When we speak of free software we are referring to freedom not price Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free soft
117. sure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy directly or through your agents or retailers of that edition to the public It is requested but not required that you contact the authors of the Document well before redistributing any large number of copies to give them a chance to provide you with an updated version of the Document 4 MODIFICATIONS You may copy and distribute a Modified Version of the Docu ment under the conditions of sections 2 and 3 above provided that you release the Modified Version under precisely this Licen se with the Modified Version filling the role of the Document thus licensing distribution and modification of the Modified Ver sion to whoever possesses a copy of it In addition you must do these things in the Modified Version A Use in the Title Page and on the covers if any a title distinct from that of the Document and from those of previous versions which should if there were any be listed in the His tory section of the Document You may use the same title as a previous version if the original publisher of that version gi ves permission B List on the Title Page as authors one or more persons or entities responsible for authorship of the modi fications in the Modified Version together with at least five of the principal authors of the Document all of its principal aut hors
118. t AO OnO O TO tOO T o TODO OOOO OOOO 09 0 00 0999 10 90 199 YD DD DDD DDD DD O y 2ti 2ti ti ti 2ti 2ti 2ti 2ti 2ti 2ti Pea 2ti ti ti 2ti 2ti 2ti tle Benutzer tle Benutzer T oe al ES28nix Emes2k tle Benutzer tle Benutzer tle Benutzer tle Benutzer tle Benutzer tle Benutzer tle Benutzer tle Benutzer tle Benutzer Enomil F _F Flominator Genrich Global667 Haddock Hardy42 Heuler06 tle Benutzer tle Benutzer tle Benutzer Hjherbert Jaho4896 Jan tle Benutzer tle Benutzer Joddel Johanna31 tle Benutzer tle Benutzer tle Benutzer tle Benutzer Juetho Klartext Klaus_ Kleidersack Weblinks 1 Komikaa 6 Kronosg6m gt 7 MF Warburg 5 MichaelFrey 2 MichaelFreyTool 7 Michfrm 11 Michael 1 Nomike 3 Ocrho 2 Pc world gt 1 Peperkorn 1 Prince Kassad 1 Produnis 6 Prog 6 Reseka 3 Robert 10 Robidog 25 Schneijo 1 Se4598 4 Stefan Majewsky 36 http de wikibooks org w index 37 http de wikibooks org w index 38 http de wikibooks org w index 39 http de wikibooks org w index 40 http de wikibooks org w index ichaelFreyTool 41 http de wikibooks org w index 42 http de wikibooks org w index 43 http de wikibooks org w index 44 http de wikibooks org w index 45 http de wikibooks org w index 46 http d
119. t is safest to attach them to the start of each source file to most effective ly state the exclusion of warranty and each file should have at least the copyright line and a pointer to where the full notice is found lt one line to give the program s name and a brief idea of what it does gt Copyright C lt year gt lt name of author gt This program is free software you can redistribute it and or mo dify it under the terms of the GNU General Public License as published by the Free Software Foundation either version 3 of the License or at your option any later version This program is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PAR TICULAR PURPOSE See the GNU General Public License for more details You should have received a copy of the GNU Gene ral Public License along with this program If not see lt http www gnu org licenses gt Also add information on how to contact you by electronic and paper mail If the program does terminal interaction make it output a short notice like this when it starts in an interactive mode lt program gt Copyright C lt year gt lt name of author gt This pro gram comes with ABSOLUTELY NO WARRANTY for de tails type show w This is free software and you are welco me to redistribute it under certain conditions type show c for details The hypothetical c
120. te es funktionieren Erstellt vor der Anderung eine Sicherheitskopie eurer Werte 6 0 16 Status iiber bearbeitete Zeilen ausgeben H ufig bearbeitet man eine Liste von Objekten mit einer FOR Schleife Damit man dar ber informiert ist wie weit die Bearbeitung bereits fortgeschritten ist kann man die Anzahl der Bearbeiteten Objekte im titel der DOS Box ausgeben lassen Schritt 1 Ermitteln z hlen der zu bearbeitenden Zeilen dies geht am besten mit folgender FOR Schleife FOR F eol tokens 1 2 3 SA IN find c liste txt DO echo C Zeilen Wobei das ein Zeichen sein muss das in jeder zu verarbeitenden Zeile vorkommt Dies ist am schnellsten Will man wirklich jede Zeile z hlen unabh ngig vom Inhalt dann kann man auch folgenden Befehl verwenden FOR F delims A IN findstr N liste txt DO echo A Zeilgn Jetzt bedarf es noch des SET Befehl zum Berechnen der aktuellen Zeile und setLocal EnableDelayedExpansion dann k nnte das Script folgenderma en aussehen echo off setLocal EnableDelayedExpansion set COUNT 0 set COUNTMAX 0 63 Programmierungshilfen FOR F eol tokens 1 2 3 A IN find c liste txt DO set COUNTMAX C for f eol tokens 1 delims j in liste txt do set A COUNT 1 title 0 COUNT Zeilen von COUNTMAX bearbeitet echo Tue etwas mit dem Token 3 REM der ping wird nur zur Verz gerung ausgeftihrt dam
121. the use of http www 7 zip org The IAIEX source itself was generated by a program written by Dirk H nniger which is freely available under an open source license from http de wikibooks org wiki Benutzer Dirk_Huenniger wb2pdf This distribution also contains a configured version of the pdflatex compiler with all necessary packages and fonts needed to compile the IATRX source included in this PDF file Inhaltsverzeichnis 1 Allgemeine Information 3 1 1 Batch Programmierung 200 3 1 2 Wie erstelle ich eine Batchdatei 4 1 3 Allgemeine Informationen o o 4 2 Wichtige DOS Kommandos 5 Joly ASSOC Area A ER A EY er 5 228 Att Ds os 2 a A BE een DENT 5 Dido ACIS E BA 5 ZA ed ehdiE 24 424 A T a a 6 2 5 CHOP pa ae 2 h e ele Bo a n RN ale oa 7 26 EIS a ienaa dai Sn T Ele hes Gt Sad a a aa Ta e eS ee A 8 2 7 compoderfe ss ee set edoae ma a a en res 8 2 8 x copy robocopy ooo a 8 Z9 date ta ta aad as eh ad ad Ee al a 8 2 10 del erase ee 9 2 11 dE ot a de ehe a 9 De DOE ee RA 10 DABS dite ua A as AA a nie alla Sg 11 DAA ERG vr AA 11 ZAS NO Ai A ES A A A E ag ee 11 2 16 format iio BE BONE a A a 11 ZAR AC pe 2 2 er IE ENDE Rep 11 2 18 IPCONNS vice ts es aie a AE MT ee A ee ES a 11 2 19 Key bi 59 08 in aa oh ha ah Ae A ee Aa En 12 220 loddhigh s 0 2 4 54 eee 2 2 eed OE ER 12 IA AN 12 222 MOE ta as ae a 12 DIME arae e o E we hres Ok Bad ne kG a
122. the work in any other way but it does not invalidate such permission if you have separately received it d If the work has interactive user interfaces each must display Appropriate Legal Notices however if the Program has inter active interfaces that do not display Appropriate Legal Notices your work need not make them do so A compilation of a covered work with other separate and inde pendent works which are not by their nature extensions of the covered work and which are not combined with it such as to form a larger program in or on a volume of a storage or di tribution medium is called an aggregate if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation s users beyond what the indivi dual works permit Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate 6 Conveying Non Source Forms You may convey a covered work in object code form under the terms of sections 4 and 5 provided that you also convey the machine readable Corresponding Source under the terms of this License in one of these ways a Convey the object code in or embodied in a physical pro duct including a physical distribution medium accompanied by the Corresponding Source fixed on a durable physical medi um customarily used for software interchange b Convey the object code in or embodied in a physical product inclu
123. toy ot E92 10 0 7 2 2 ipconfig renew Sollten die Netzwerkkonfigurationen nicht mehr aufzufinden sein dann hilft oft der Parameter renew Beispiel C gt ipconfig renew 7 2 3 ipconfig flushdns Situation Eine Homepage wird nicht angezeigt stattdessen wird eine Fehlermeldung ange zeigt wie z B Die Website k nnte voriibergehend nicht erreichbar sein versuchen Sie es bitte sp ter nochmals Als Test wird der Server angepingt und es kommt eine Fehlermeldung 67 Netzwerkumgebung Zeittiberschreitung der Anforderung Der Administrator kiimmert sich um das Problem und sagt der Server sei wieder OK aber noch immer kommen Fehlermeldungen und Homepages k nnen nicht angezeigt werden Dann kann es daran liegen dass der DNS Cache noch die Fehlmeldung gespeichert hat und dieser muss geleert werden Anstelle den Rechner neu zu starten gibt man folgendes ein C gt ipconfig flushdns Windows IP Konfiguration Der DNS Aufl sungscache wurde geleert C gt 7 3 tracert Mit tracert kann man die Route vom eigenen PC zur Zieladresse verfolgen und evtl R ckschl sse ziehen ob und warum eine Verbindung h ngt Beispiel C gt tracert de wikibooks org Ausgabe Routenverfolgung zu rr knams wikimedia org 145 97 39 155 ber maximal 30 Abschnitte 1 lt 1 ms lt 1 ms lt l ms 123 456 789 1 2 24 ms 18 ms 19 ms adslgwOl fra4 rm com net 217 173 128
124. u may if authorized by the copyright holders of that material supplement the terms of this License with terms a Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License or b Requi ring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it or c Prohibiting misrepre sentation of the origin of that material or requiring that modi fied versions of such material be marked in reasonable ways as different from the original version or d Limiting the use for publicity purposes of names of licensors or authors of the ma terial or e Declining to grant rights under trademark law for use of some trade names trademarks or service marks or f Requiring indemnification of licensors and authors of that mate rial by anyone who conveys the material or modified versions of it with contractual assumptions of liability to the recipient for any liability that these contractual assumptions directly im pose on those licensors and authors All other non permissive additional terms are considered fur ther restrictions within the meaning of section 10 If the Pro gram as you received it or any part of it contains a notice sta ting that it is governed by this License along with a term that is a further restriction you may remove that term If a license do cument contains
125. ume of a storage or distribution medium is called an ggregateif the copyright resulting from the compilation is not used to limit the legal rights of the compilation s users beyond what the in dividual works permit When the Document is included in an aggregate this License does not apply to the other works in the 13 3 GNU Lesser General Public License GNU LESSER GENERAL PUBLIC LICENSE Version 3 29 June 2007 Copyright 2007 Free lt http fsf org gt Software Foundation Inc Everyone is permitted to copy and distribute verbatim copies of this license document but changing it is not allowed This version of the GNU Lesser General Public License incor porates the terms and conditions of version 3 of the GNU Gene ral Public License supplemented by the additional permissions listed below 0 Additional Definitions As used herein this License refers to version 3 of the GNU Lesser General Public License and the GNU GPL refers to version 3 of the GNU General Public License The Library refers to a covered work governed by this Licen se other than an Application or a Combined Work as defined below An Application is any work that makes use of an interface provided by the Library but which is not otherwise based on the Library Defining a subclass of a class defined by the Li brary is deemed a mode of using an interface provided by the Library A Combined Work is a work produced by com
126. ummer Nummer 1 2 IN 1 1 3 DO echo Nummer N 1 2 3 IN 1 1 4 DO echo Nummer N 1 2 3 4 IN 1 1 5 DO echo Nummer N Weitere M glichkeiten der FOR Schleife syntax FOR Files 28 FOR FOR parameter IN set DO command syntax FOR Files Rooted at Path FOR R drive path parameter IN set DO command syntax FOR Folders FOR D parameter IN folder_set DO command syntax FOR List of numbers FOR L parameter IN start step end DO command syntax FOR File contents FOR F options parameter IN filenameset DO command FOR F options parameter IN Text string to process DO conmand syntax FOR Command Results FOR F options parameter IN command to process DO command Beispiel Sucht im Ordner C Windows Temp rekursiv nach Dateien mit dem Na men temp dat und gibt die Liste aus Die Option token ist notwendig damit die Ausgabe zeilenweise gelesen wird und auch Pfade mit enthaltenem Leerzeichen ausgegeben werden k nnen for F tokens x f in dir S b C Windows Temp temp dat do echo S Z hlvariablen in Zeichenketten einbetten Um die Z hlvariable f f auf der Kommandozeile in einer Zeichenfolge zu verwenden wird einfach die Variable in dem String eingebettet 29 Batch Befehle FOR f IN A BC DE DO echo mitten fdrinnen 3 11 GOTO
127. usgedruckten Ergebnisse abholen 1 2 Wie erstelle ich eine Batchdatei Wie bereits gesagt reicht ein einfacher Editor aus Empfehlen kann man guten Gewissens den quelloffenen und kostenlosen Notepad Editor als bessere Alter native zu MS Notepad Speichern Sie dann die Datei mit der Endung x bat ab Anschlie end m ssen Sie nur die Datei starten Dies k nnen Sie entweder direkt in Windows oder indem Sie in der DOS Eingabeaufforderung in das entsprechende Verzeichnis wechseln und den Dateinamen eingeben Unter Windows NT kompatiblen Betriebssystemen gibt es seit Windows 2000 auch Batchdateien mit der Endung x cmd Diese werden genau wie Batchdateien mit der Endung bat verarbeitet bzw ausgef hrt Die Endung cmd wurde urspr nglich aus Kompatibilit tsgr nden zu OS 2 einem Betriebssystem das MS urspr nglich in Kooperation mit IBM entwickelte mit Windows NT 3 x eingef hrt 1 3 Allgemeine Informationen e Allgemeine Informationen Wikipedia batch e Infos zur cmd exe Wikipedia cmd exe e Die f r Windows XP verf gbaren Kommandos k nnen auch im Hilfesystem von Windows direkt eingesehen werden e START Hilfe und Support e Befehlszeilenreferenz A Z in das Suchfeld eintragen F r englisches Win dows Command line reference A Z http notepad plus sourceforge net de site htm http de wikipedia org wiki Stapelverarbeitung 4 http de wikipedia org wiki cmd exe Wn 2 Wichtige DOS Kommandos Man untersche
128. utzer und alle Anwendungen zug nglich sind Zus tzlich hat jeder Benutzer seinen eigenen Variablenraum Jede Anwendung die nun vom System gestartet wird erhalt einen eigenen Variablenraum der als Kopie aus dem der aufrufenden Anwendung erzeugt wird ndert das Programm etwas Wert nderung neue Varia ble wirkt sich dies nicht auf parallel gestartete Anwendungen oder das System aus Lediglich Prozesse die von der Anwendung gestartet werden erhalten eine Kopie des Anwendungsvariablenraumes Dadurch ist es nicht m glich dass Anwendungen Umgebungsvariablen setzen die dann anschlie end in einer Batchdatei verwertbar sind Beispiel echo off set a 2 echo a command c set a 1 echo a Unter Dos w rde die Ausgabe lauten Unter Windows NT 2000 XP 1 http www dostips com DtTipsStringManipulation php _T0c135152735 49 Erweiterungen unter Windows NT Das hei t nicht dass unter Windows NT und Nachfolgern der Befehl set a 1 keinen Effekt h tte sondern dieser wird in einer gesch tzten Umgebung ausgef hrt die dann au erhalb dieser Umgebung keinen Effekt mehr hat F r die aufgerufene Variante von command ist a nach dem set Befehl sehr wohl gleich 1 Noch eine nderung Variablen betreffend 5 4 Die Kommandozeile lernt Rechnen Seit Windows NT 4 kann man mit dem set Befehl auch Rechnen Ein Beispiel set a 1 2 3 Man kann das Ergebnis auch in Variablen schreiben
129. wird nur ausgefiihrt wenn der erste Befehl fehlschlug Syntax befehll befehl2 Stapelanweisung Ab bis Windows 7 Beispiel Inhalt copy test txt test2 txt echo Fehler beim Kopieren 42 Ausgabe Fehler beim Kopieren falls test txt nicht existiert oder test2 txt nicht geschrieben bzw tiberschrieben werden konnte 4 5 lt Umleitung der Eingabe Syntax befehl lt file Beispiel Inhalt echo Hallo gt tmp txt set P v lt tmp txt echo v Ausgabe Hallo set P v w rde eine Zeile vom Bediener erwarten durch die Umleitung wird diese Zeile von der Datei tmp txt gelesen die zuvor mittels Umleitung der Ausgabe siehe unten bef llt wurde 4 6 gt Umleitung der Standard Ausgabe zu einem anderen Ziel Wenn das Ziel eine Datei ist wird diese neu angelegt falls die Datei schon existiert wird sie zuvor gel scht Es kann aber auch nach NUL Die Ausgabe verschwindet oder CON Bildschirm umgeleitet werden Syntax befehl gt file oder auch mit vorrangestellter Umleitung praktisch wenn bei der Ausgabe einzelne vorkommen gt file befehl 43 Batch Operatoren Beispiel Inhalt echo Hallo gt tmp txt type tmp txt Ausgabe Hallo Neben der Standard Ausgabe stdout gibt es noch eine Fehlerausgabe stderr Normalerweise landen die Standard Ausgabe und die Fehler Ausgabe am Bild schirm wodurch der Unterschied nicht auffallt Wenn die Standard Ausgabe auf eine Datei umgel
Download Pdf Manuals
Related Search
Batch Programmierung batch-programmierung batch programmierung errorlevel batch programmierung windows batch programmierung pdf batch programmierung befehle
Related Contents
11196_Manual coifas Tradition Line rev 01_EM PRODUÇÃO SK User Manual H23 風雨実験棟乱流境界層風洞その他復旧整備 仕様書 Informazioni per l`utente MINI Online Treasury Manager: Account Transfer Honey-Can-Do CRT-01149 Instructions / Assembly Schneider Electric Communication Drivers User's Manual Android Phone Integration User`s Manual I IC G4SFE6 G6SFE6 G6SFEA6 - mbm Copyright © All rights reserved.
Failed to retrieve file