I need reliable way to create %tab% (containing one tab character) for both, Windows and XP.
SET TAB=" "
Should work for Windows 7 (not tested) but not for Win XP (tested).
This
for /F "skip=4 delims=pR tokens=1,2" %%a in ( 'reg query hkcu\environment /v temp' ) do set TAB=%%b
works for Win XP only.
You should use an editor which supports TAB characters without changing them to spaces.
And you should reorder the quotes, as with
set TAB=" "you got a variable with three characters.TAB contains then also the quotes.
Currently there seems to be no reliable way to use a program to create a TAB character in all Windows versions on all language platforms.
But you could also use an embedded Jscript snippet.