How do I set the timezone from command line ?

60,524

Solution 1

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]

Solution 2

If anyone still uses Windows XP (as I do):

Step 1:

You can use the following command line, e.g. in the "Execute" window (cmd):

Control.exe TIMEDATE.CPL,,/Z W. Europe Standard Time

Where "W. Europe Standard Time" is, not really surprisingly, for Western Europe. Other possible values are e.g.

  • E. Europe Standard Time (for Eastern Europe)
  • Pazifik Standard Time (for what it says)

and so on. A list of possible values can be found here (although for Windows Vista, but it seems most values are the same):

https://technet.microsoft.com/en-us/library/cc749073%28v=ws.10%29.aspx

Step 2

In order to run the above command from a shortcut, you can do the following:

Create a new shortcut (e.g. in Windows explorer, right-click anywhere in an empty area, and choose "New shortcut") and give it the following value (by entering the code into the window that opens, or as "target" in the accordingly named field):

C:\Windows\System32\cmd.exe /c Control.exe TIMEDATE.CPL,,/Z W. Europe Standard Time

(The example uses W. Europe Standard Time; change this to your liking)

Calling this shortcut (i.e. clicking the Icon) immediately changes the timezone.

For my needs, I created two such shortcuts, one setting the timezone to Western Europe, the other setting it to Eastern Europe, as these are the locations where I am working regularly.

(Source for Step 2: Run a Command Prompt command from Desktop Shortcut)

Solution 3

If you have PowerShell 5.1, you have the equivalent of tzutil in PowerShell. For example, if you have Windows 10.

Examples:

See current time zone:

Get-TimeZone

See available time zones:

Get-TimeZone -ListAvailable

Set a time zone:

Set-TimeZone -Name "Georgian Standard Time"

Source: https://www.sysadmit.com/2019/08/cambiar-zona-horaria-Windows.html

Share:
60,524
Eduard Florinescu
Author by

Eduard Florinescu

Coding my way out of boredom. “If the fool would persist in his folly he would become wise.” (William Blake)

Updated on August 19, 2020

Comments

  • Eduard Florinescu
    Eduard Florinescu over 3 years

    How can I set the timezone in Windows from command line or from a batch file?

    Do I need to use powershell or cscript?

  • Pacerier
    Pacerier about 8 years
    @Christian, Is there a way to set arbitrary timezones like +15:00 GMT?
  • Pacerier
    Pacerier about 8 years
    @IonicăBizău, Does this add a log in eventviewer like the "normal UI" does?
  • Christian Geiselmann
    Christian Geiselmann about 8 years
    You mean, not calling specific time zone names (such as "Western Europe") but the time given in numbers (+15:00)?
  • Pacerier
    Pacerier about 8 years
    @ChristianGeiselmann, I mean arbitrary timezones that exist outside of specific time zone names. See this comment: stackoverflow.com/questions/4976696/… . E.g. +15:00 (note that there isn't really a +15:00) or +08:12
  • RozzA
    RozzA over 7 years
    -1 this answer just adds unnecessary "fluff" to the accepted one, plus answers a completely unasked question "how to make a batch file", not to mention the inconsistent use of "quote marks" -- then, after much extended detail on which text editor to use, how to name my file, where to save it AND how to execute it, at step 4 I am informed to simply: Open the "Execute" window (cmd)
  • Christian Geiselmann
    Christian Geiselmann over 7 years
    Thanks for commenting. This detailed instruction was written for people with less computing experience than you. (It tackles issues I myself had with the original answer.) Therefore it includes some parts that you may well find too verbose (e.g. mentioning how to create a text file), but I am sure there are people to whom such redundance will be helpful. - As for your remark about quotation marks: I checked it again now, and I still found their use quite consistent. Perhaps you are used to other rules from your environment? In my, this is typographcally good practice.
  • wmassingham
    wmassingham about 7 years
    Yes, this logs an event. You can set the time zone to whatever the current zone is to generate one.