4 Pluspunkte 0 Minuspunkte

Wie kann ich in einer Batch Datei einen Tab "\t" ausgeben?

echo Hello\tWorld
von  

1 Antwort

0 Pluspunkte 0 Minuspunkte

Ein Tabulatorzeichen hat den Hexadezimalwert von 0x09. Hier ist eine Funktion die "0x09" in einen Tabulator umwandelt.

:HexPrint
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
FOR /F delims^=^ eol^= %%# in (
'FORFILES /m "%~nx0" /c "%ComSpec% /cECHO(%~1"'
) Do (Echo(%%#)
exit /b

Um einen Tabulator darszustellen kannst du die Funktion folgendermaßen aufrufen.

call :hexprint "Hallo0x09Welt"

Das "0x09" wird somit automatisch als ASCII Wert dargestellt.

von (716 Punkte)