Skip to content

Instantly share code, notes, and snippets.

@tnhung2011
Created December 17, 2025 13:05
Show Gist options
  • Select an option

  • Save tnhung2011/fdd90c5b81ea219159a4d5b1d73c8eee to your computer and use it in GitHub Desktop.

Select an option

Save tnhung2011/fdd90c5b81ea219159a4d5b1d73c8eee to your computer and use it in GitHub Desktop.
Get your current timezone. More useful output than "tzutil /g".
@echo off
setlocal enableextensions enabledelayedexpansion
for /f "delims=" %%i in ('tzutil /g') do (
for /f "delims=:" %%j in ('tzutil /l ^| findstr /N /C:"%%i"') do (
set /a "toSkip=%%j-1"
goto print
)
)
:print
for /f "delims=() tokens=2" %%i in ('^(tzutil /l ^| findstr /N $^) ^| findstr /R /C:"^%toSkip%"') do echo %%i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment