User Tools

Site Tools


os:windows:batch

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
os:windows:batch [2011-02-09 17:20] rootos:windows:batch [2016-05-25 08:54] (current) root
Line 24: Line 24:
  
 Der Ablauf: Der Ablauf:
-  call wird ausgeführt, zu Sprungpunkt :r +  call wird ausgeführt, zu Sprungpunkt :r 
-  :r liest wert von Tastatur ein uns speichert ihn in in die Variable "read"+  :r liest wert von Tastatur ein uns speichert ihn in in die Variable "read"
-  :r wird beendet mit goto:eof +  :r wird beendet mit goto:eof 
- +  call wird ausgeführt, zu Sprungpunkt :p, übergeben wird die Variable read 
-  call wird ausgeführt, zu Sprungpunkt :p, übergeben wird die Variable read +  das erste Argument, welche dem Sprungpunkt über die Call-Funktion mitgegeben wird, wird ausgegeben 
-  das erste Argument, welche dem Sprungpunkt über die Call-Funktion mitgegeben wird, wird ausgegeben +  :p wird beendet mit goto:eof 
-  :p wird beendet mit goto:eof +  pause wird ausgeführt 
- +  batch-file wird beendet
-  pause wird ausgeführt +
- +
-  batch-file wird beendet +
- +
-Skelett: +
- +
-  @echo off +
-   +
-  call :function1 +
-  call :function2 argument1 argument2 +
-  goto:eof +
-   +
-   +
-  :function1 +
-   +
-  goto:eof +
-   +
-   +
-  :function2 +
-   +
-  goto:eof+
      
 ==== Beispiele ==== ==== Beispiele ====
Line 65: Line 44:
 goto:eof goto:eof
 :sleep :sleep
-ping -n 1 -w %1000 1.2.3.>nul 2>&1+ping -n 1 -w %1000 192.0.2.>nul 2>&1
 goto:eof goto:eof
 </code> </code>
Line 73: Line 52:
 call:sleep 5 call:sleep 5
 </code> </code>
 +
 +IP-Adressse: [[https://tools.ietf.org/html/rfc5737|RFC5737]]
  
 === counter === === counter ===
Line 157: Line 138:
 where pg_dump.exe >nul 2>&1 || set PATH=%PATH%;C:\Program Files (x86)\PostgreSQL\bin;C:\Program Files\PostgreSQL\bin where pg_dump.exe >nul 2>&1 || set PATH=%PATH%;C:\Program Files (x86)\PostgreSQL\bin;C:\Program Files\PostgreSQL\bin
 </code> </code>
 +
 +== NAS Netzlaufwerk Sortierung mit dir ==
 +Wird ein Share eines NAS, wie zum Beispiel Q-NAP TS-210 als Netzlaufwerk gemappt, bemerkt man schnell, dass beim Ausführen von //dir// eine willkürliche Sortierung verwendet wird:
 +
 +<code>
 +M:\Betontod\Schwarzes Blut>dir
 + Volume in drive M is MP3
 + Volume Serial Number is BD65-0021
 +
 + Directory of M:\Betontod\Schwarzes Blut
 +
 +09.12.2009  14:49    <DIR>          .
 +01.03.2010  21:42    <DIR>          ..
 +21.03.2010  12:26         3'644'186 09-Betontod - Vielleicht wird alles gut.mp3
 +21.03.2010  12:26         4'108'174 10-Betontod - Viva Punk!.mp3
 +21.03.2010  12:26         3'797'211 11-Betontod - Wind.mp3
 +21.03.2010  12:26         3'773'773 01-Betontod - Generation X.mp3
 +21.03.2010  12:26         6'164'432 07-Betontod - Kinder des Zorns.mp3
 +21.03.2010  12:26         2'546'439 08-Betontod - Im Sumpf des Verbrechens.mp3
 +21.03.2010  12:26         3'080'891 02-Betontod - Schwarzes Blut.mp3
 +21.03.2010  12:26         2'944'279 12-Betontod - All die Jahre.mp3
 +21.03.2010  12:26         3'870'026 06-Betontod - Glück auf.mp3
 +21.03.2010  12:26         3'132'548 05-Betontod - Zweifel.mp3
 +21.03.2010  12:26         3'229'667 03-Betontod - Feuer Frei!.mp3
 +21.03.2010  12:26         2'936'122 04-Betontod - Stillstand.mp3
 +              12 File(s)     43'227'748 bytes
 +               2 Dir(s)  174'093'758'464 bytes free
 +</code>
 +
 +Mit dem Parameter ///o// wird eine Sortierung erzwungen. Will man jedoch nicht bei jedem dir-Command diesen Parameter anhängen, kann man diesen in der dircmd-Variable definieren:
 +
 +  set dircmd=/o
 +
 +In folgendem Beispiel wird nochmals der Befehl //dir// ausgeführt, jedoch mit der zuvor definierten dircmd-Variable:
 +
 +<code>
 +M:\Betontod\Schwarzes Blut>dir
 + Volume in drive M is MP3
 + Volume Serial Number is BD65-0021
 +
 + Directory of M:\Betontod\Schwarzes Blut
 +
 +09.12.2009  14:49    <DIR>          .
 +01.03.2010  21:42    <DIR>          ..
 +21.03.2010  12:26         3'773'773 01-Betontod - Generation X.mp3
 +21.03.2010  12:26         3'080'891 02-Betontod - Schwarzes Blut.mp3
 +21.03.2010  12:26         3'229'667 03-Betontod - Feuer Frei!.mp3
 +21.03.2010  12:26         2'936'122 04-Betontod - Stillstand.mp3
 +21.03.2010  12:26         3'132'548 05-Betontod - Zweifel.mp3
 +21.03.2010  12:26         3'870'026 06-Betontod - Glück auf.mp3
 +21.03.2010  12:26         6'164'432 07-Betontod - Kinder des Zorns.mp3
 +21.03.2010  12:26         2'546'439 08-Betontod - Im Sumpf des Verbrechens.mp3
 +21.03.2010  12:26         3'644'186 09-Betontod - Vielleicht wird alles gut.mp3
 +21.03.2010  12:26         4'108'174 10-Betontod - Viva Punk!.mp3
 +21.03.2010  12:26         3'797'211 11-Betontod - Wind.mp3
 +21.03.2010  12:26         2'944'279 12-Betontod - All die Jahre.mp3
 +              12 File(s)     43'227'748 bytes
 +               2 Dir(s)  174'093'758'464 bytes free
 +</code>
 +
 ===== Links ===== ===== Links =====
   * [[http://de.wikibooks.org/wiki/Batch-Programmierung:_Beispiele]]   * [[http://de.wikibooks.org/wiki/Batch-Programmierung:_Beispiele]]
os/windows/batch.1297268450.txt.gz · Last modified: 2014-12-18 20:10 (external edit)