change timezone based on number

lets say i have a file zones.txt
inside this file I have the following
1 central standard time
2 central standard time
3 eastern standard time

how via a bat script can I read that file and pass it to tzutil

basically in the script it will say type location number so i hit 3
it will then search the text file and issue the command tzutil /s "Eastern Standard Time"

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

For the fun of it, here's a complete menu that's built based on the zones.txt. It only displays and accepts the values found in there. It's in test mode and will only display the tzutil command it would normally run; remove the uppercase ECHO in line 25 to run it for real.
@echo off
setlocal enabledelayedexpansion
REM *** %~dp0 expands to the script's Drive and Path, including a trailing backslash.
set TZFile=%~dp0zones.txt

for /f "tokens=1 delims=" %%a in ('set Menu[ 2^>NUL') do (set %%a=)
for /f "tokens=1* delims= " %%a in ('type "%TZFile%"') do (set Menu[%%a]=%%b)
echo =============================================
echo       Time zone selection
echo =============================================
for /f "tokens=2* delims=[]=" %%a in ('set Menu[') do (echo [%%a] %%b)
echo ----------
echo [X] Exit
echo ----------
set /p Choice=Please enter your choice: 
if "%Choice%"=="" goto MenuLoop
if "%Choice: =%"=="" goto :MenuLoop
if /i "%Choice%"=="X" goto :eof
if not defined Menu[%Choice%] goto MenuLoop
set TimeZone=!Menu[%Choice%]!
echo Time zone picked: %TimeZone%
ECHO tzutil.exe /s "%TimeZone%"

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bbimisAuthor Commented:
thank you so much i can use this as a baseline of what i'm trying to do.
bbimisAuthor Commented:
just curious where is the zones.txt file at so i can look at its format ?
The format is as described in your question.
bbimisAuthor Commented:
oh okay cool thanks!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.