Mowgli
Mowgli

Reputation: 3512

How to make two column in a batch file?

I am have 1 column, it asks for user input or stream they want to watch, but one columns isn't enough to fist all channels.

Here is screenshot of how it looks.
enter image description here


How can I make it show 1 to 10 in first column and 11 to 20 in second column.

Here is my code.. excluding stream links.

<br><br>
@echo off
rem mode con:cols=60 lines=16
mode con:cols=50 lines=40

:VRH
title HD Indian Channels By  
cls
COLOR 0E
echo       Install VLC Player & OctoShape: VLC Player
echo        Select Channel Number You Want To Watch!
echo.
echo             (1)  = Sahara Samay     +1
echo             (2)  = India TV         +2
echo             (3)  = NDTV Hindi       +3
echo             (4)  = Sahara Mumbai    +4
echo             (5)  = Times Now        +5
echo             (6)  = Saharah AP       +6
echo             (7)  = News X           +7
echo             (8)  = Punjabi          +8
echo             (9)  = Al Jazeera Sport +9
echo             (10) = Al Jazeera Sport +10
echo             (11) = Aaj Tak          +11
echo             (12) = Headlines Today  +12
echo             (13) = UTV Bindaas      +13
echo             (14) = HumTV            +14
echo             (15) = M Tunes          +15
echo             (16) = HumTV            +16
echo             (17) = Masalaa TV       +17
echo             (18) = Zee Cinema       +18
echo             (19) = B4u Music        +19
echo             (20) = Zing             +20
echo             (21) = Zee TV           +21
echo             (22) = ETV US           +22
echo             (23) = Zoom TV          +23
echo             (24) = Al Jazeera Eng   +24
echo             (25) = 9xm Jalwa        +25
echo             (26) = Headlines Today  +26
echo             (27) = UTV US Movies    +27
echo             (28) = UTV Bindaas      +28
echo             (29) = UTV Bindaas      +29
echo             (30) = UTV Bindaas      +30
echo.
echo                     (O)  = Izlaz

if exist C:\Progra~1\VideoLAN\VLC (set "vlc=C:\Progra~1\VideoLAN\VLC\vlc") 
if exist C:\Progra~2\VideoLAN\VLC (set "vlc=C:\Progra~2\VideoLAN\VLC\vlc")
if exist C:\Program Files\VideoLAN\VLC (set "C:\Program Files\VideoLAN\VLC\vlc")
if exist D:\Program Files\VideoLAN\VLC (set "D:\Program Files\VideoLAN\VLC\vlc")
if exist C:\Program Files (x86)\VideoLAN\VLC (set "C:\Program Files (x86)\VideoLAN\VLC\vlc")
if exist C:\Program Files(x86)\VideoLAN\VLC (set "C:\Program Files(x86)\VideoLAN\VLC\vlc")
if exist C:\Program Files (x64)\VideoLAN\VLC (set "C:\Program Files (x64)\VideoLAN\VLC\vlc")
if exist C:\Program Files(x64)\VideoLAN\VLC (set "C:\Program Files(x64)\VideoLAN\VLC\vlc")

set /p "Choice=>"

IF "%Choice%"=="0" GOTO 0
IF "%Choice%"=="1" GOTO 1
IF "%Choice%"=="2" GOTO 2
IF "%Choice%"=="3" GOTO 3
IF "%Choice%"=="4" GOTO 4
IF "%Choice%"=="5" GOTO 5
IF "%Choice%"=="6" GOTO 6
IF "%Choice%"=="7" GOTO 7
IF "%Choice%"=="8" GOTO 8
IF "%Choice%"=="9" GOTO 9
IF "%Choice%"=="10" GOTO 10
IF "%Choice%"=="11" GOTO 11
IF "%Choice%"=="12" GOTO 12
IF "%Choice%"=="13" GOTO 13
IF "%Choice%"=="14" GOTO 14
IF "%Choice%"=="15" GOTO 15
IF "%Choice%"=="16" GOTO 16
IF "%Choice%"=="17" GOTO 17
IF "%Choice%"=="18" GOTO 18
IF "%Choice%"=="19" GOTO 19
IF "%Choice%"=="20" GOTO 20
IF "%Choice%"=="21" GOTO 21
IF "%Choice%"=="22" GOTO 22
IF "%Choice%"=="23" GOTO 23
IF "%Choice%"=="24" GOTO 24
IF "%Choice%"=="25" GOTO 25
IF "%Choice%"=="26" GOTO 26
IF "%Choice%"=="27" GOTO 27
IF "%Choice%"=="28" GOTO 28
IF "%Choice%"=="29" GOTO 29
IF "%Choice%"=="30" GOTO 30


echo.
echo Odaberi od 1 do 10...
echo.
ping localhost -n 3 >nul
goto VRH

not including all cases if selected I don't think that is needed..

:0
cls
echo Al Jazeera Sports in VLC by D3n1s
ping localhost -n 3 >nul
exit /b 

Upvotes: 1

Views: 5653

Answers (3)

Aacini
Aacini

Reputation: 67216

If you want to display two columns in the same line of the screen, you must assemble the desired output (two columns) in the echo command. To do that, you must have a way to separate the two columns; an usual way to do that is using TAB character. To get the TAB character in Win-XP, you may use this code:

for /F "skip=4 delims=pR tokens=1,2" %%a in (
       'reg query hkcu\environment /v temp' ) do set TAB=%%b

To show the output in the way you want ("show 1 to 10 in first column and 11 to 20 in second column"), you may use this code:

@echo off
setlocal EnableDelayedExpansion
rem Get TAB character
for /F "skip=4 delims=pR tokens=1,2" %%a in (
       'reg query hkcu\environment /v temp' ) do set TAB=%%b

rem Show the desired output
echo             (1)  = Sahara Samay     +1!TAB!(11) = Aaj Tak          +11
echo             (2)  = India TV         +2!TAB!(12) = Headlines Today  +12
echo             (3)  = NDTV Hindi       +3!TAB!(13) = UTV Bindaas      +13
echo             (4)  = Sahara Mumbai    +4!TAB!(14) = HumTV            +14
echo             (5)  = Times Now        +5!TAB!(15) = M Tunes          +15
echo             (6)  = Saharah AP       +6!TAB!(16) = HumTV            +16
echo             (7)  = News X           +7!TAB!(17) = Masalaa TV       +17
echo             (8)  = Punjabi          +8!TAB!(18) = Zee Cinema       +18
echo             (9)  = Al Jazeera Sport +9!TAB!(19) = B4u Music        +19
echo             (10) = Al Jazeera Sport +10!TAB!(20) = Zing             +20

However, I strongly encourage you to manage this type of data in an array. See this link for further details.

You may review and advanced Batch program that show two columns of data at this post

I hope it helps...

Antonio

Upvotes: 1

RonaldBarzell
RonaldBarzell

Reputation: 3830

Assuming you are trying to paginate (show several rows, then pause while the user presses a key, then show the next set and so on) then you can just insert pause every place you want it to wait. The system will then pause and ask the user to press any key to continue, and when the user does, it will continue.

For instance:

echo             (1)  = Sahara Samay     +1
echo             (2)  = India TV         +2
echo             (3)  = NDTV Hindi       +3
echo             (4)  = Sahara Mumbai    +4
echo             (5)  = Times Now        +5
echo             (6)  = Saharah AP       +6
echo             (7)  = News X           +7
echo             (8)  = Punjabi          +8
echo             (9)  = Al Jazeera Sport +9
echo             (10) = Al Jazeera Sport +10
pause
echo             (11) = Aaj Tak          +11
echo             (12) = Headlines Today  +12
echo             (13) = UTV Bindaas      +13
echo             (14) = HumTV            +14
echo             (15) = M Tunes          +15
echo             (16) = HumTV            +16
echo             (17) = Masalaa TV       +17
echo             (18) = Zee Cinema       +18
echo             (19) = B4u Music        +19
echo             (20) = Zing             +20
pause

And so on

Upvotes: 1

power
power

Reputation: 331

Use your Tab button. Also check MORE and LESS utils.

Upvotes: 1

Related Questions