How to set TIMEZONE from command line

J

Jerome Whelan

Is it possible to set the timezone (from US
Eastern to GMT, for example) from the command line
(ie; using a script rather than a GUI ) ?
 
T

Torgeir Bakken (MVP)

Jerome said:
Is it possible to set the timezone (from US
Eastern to GMT, for example) from the command line
(ie; using a script rather than a GUI ) ?

Hi

Time zone change from command line (Win2k/WinXP):

Control.exe TIMEDATE.CPL,,/Z (GMT-08:00) Pacific Time (US & Canada); Tijuana

alternatively:
RUNDLL32.EXE SHELL32.DLL,Control_RunDLL TIMEDATE.CPL,,/Z (GMT-08:00) Pacific
Time (US & Canada); Tijuana

where '(GMT-08:00) Pacific Time (US & Canada); Tijuana' is the timezone to be
set.

Input value behind /Z is from the Display value under the registry key
'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones'

You can use the Std value in those registry keys as well, this is equivalent
with "(GMT-08:00) Pacific Time (US & Canada); Tijuana":

Control.exe TIMEDATE.CPL,,/Z Pacific Standard Time
 
J

Jerome Whelan

Torgeir - I thank you much for your suggestion, it
works for me, I used "Control.exe TIMEDATE.CPL,,/Z
GMT Standard Time" and I get what I need.

This made me think about replacing my other codes
which directly write the registry with command
line calls to the control panel applets. I read
your suggestion about help from from Microsoft:
Administration scripting examples and an ONLINE version of the 1328 page
Scripting Guide:
http://www.microsoft.com/technet/scriptcenter
but I did not notice where you learned that the /Z
switch could be used for Timezone. I also read my
"Windows 2000 Professional Resource Kit" and I
still do not understand.

For example I want to change the short date format
to HH:mm:ss and I have been doing this by
registry write, but based on your example I
thought about "Control.exe Intl.Cpl,,3" and this
brings up the proper panel, but I do not know what
switches to use to change the time display
formats? Where do you find such things?

Thanks again for your first help!!



"Torgeir Bakken (MVP)"
Hi

Time zone change from command line (Win2k/WinXP):

Control.exe TIMEDATE.CPL,,/Z (GMT-08:00) Pacific Time (US & Canada); Tijuana

alternatively:
RUNDLL32.EXE SHELL32.DLL,Control_RunDLL
TIMEDATE.CPL,,/Z (GMT-08:00) Pacific
Time (US & Canada); Tijuana

where '(GMT-08:00) Pacific Time (US & Canada); Tijuana' is the timezone to be
set.

Input value behind /Z is from the Display value under the registry key
'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones'

You can use the Std value in those registry keys as well, this is equivalent
with "(GMT-08:00) Pacific Time (US & Canada); Tijuana":

Control.exe TIMEDATE.CPL,,/Z Pacific Standard Time



--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page
Scripting Guide:
http://www.microsoft.com/technet/scriptcenter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top