How can I set the timezone in Windows from command line or from a batch file?
Do I need to use powershell or cscript?
You can check this by running the command ls -l /etc/localtime from the terminal. In this example, you can see the time zone is set to Central Standard Time, or UTC-6. The more modern method uses the timedatectl command, which is also used on today's Linux systems to set the time zone.
Use Windows utility or the BIOS to set the time. The set-time command sets the current system time. The hours are specified from 00 (12:00 AM) to 23 (11:00 PM). The current time can be displayed by pressing CTRL+M or Enter at the TCL prompt, or by entering the TCL command time.
The command line utility that helps you change the time zone in Windows 7 is tzutil.exe
and is known as Windows Time Zone Utility. This is a great tool for all the people who prefer working from the command prompt.
Use the /s
parameter to set the time zone:
tzutil /s "universal standard time"
Use the /g
parameter to get the time zone:
tzutil /g
Use the /l
parameter to list the valid time zones.
tzutil /l
[source]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With