How do I echo a TAB char on a command prompt
Just hit the TAB key in an editor that supports it, Notepad for example.
So, if I enter this:
@echo 1<TAB>b
@echo 2<TAB>c
It would result in this:
One solution is that you can set an environment variable called TAB and set the value to the actual tab character. You may need to copy and paste the tab character from a text editor to get it to be entered correctly. I have tried this in Windows 7 and it works.
In your batch file, just use %TAB% and it will insert a tab character.
Limitations such as this are among the reasons to use Windows Script Host or Powershell.
Windows Script Host shipped (ships) with every Windows version from 98 on and can be installed on 95 and NT 4.
Create a file called demo.vbs
and paste the following line in it and save it.
WScript.StdOut.WriteLine "a" + chr(9) + "b"
Now, from the directory where you saved it, enter:
demo.vbs
and you should see:
a b
You can also do
cscript demo.vbs
which will allow you to use the command line switches that cscript
provides.
(Tested on Vista.)