Batch tricks fuer cmd.exe

Aus Hergipedia
Zur Navigation springen Zur Suche springen
  • Mastertip: alles Komplexe in FOR Kommando
z.B.: Backquotes `command` + grep
FOR /F "delims= tokens=" ('command') DO
  • Variablen setzen (Quoting unnoetig)
set a=Dies ist ein Test.
echo %a%
-> Output: Dies ist ein Test
  • Variablensubstitution:
interactive: %VARNAME%
batch:  %%VARNAME%%
  • redirection auch am Anfang
 > hello.txt echo hello
 >> hello.txt echo world!
  • Quote mit ^