Jump to content

Fastest way (command line?) to Change System Locale


 Share

Recommended Posts

Hi, I'm trying to make a script that will change system locale in Windows 7 I know that there is a registry way but it won't work on complex scripts (Asia) cuz it won't register special fonts.

I've been searching for about 2 days now and I found a way but it only works in Windows XP. You have to make a file called locale.txt and put it in partition C with below lines:

[RegionalSettings]
Language=0401
LanguageGroup=13
SystemLocale=0401
UserLocale=0401
InputLocale=0409:00000409,0401:00000401
UserLocale_DefaultUser=0401:00000401
InputLocale_DefaultUser=0401:00000401

Then execute the command below (this will change system to Arabic with Arabic keyboard/input):

rundll32 shell32, Control_RunDLL intl.cpl,,/f:"c:\locale.txt"

Which can be easily turned into autoit.

Does anybody knows how to do this or something like this in Windows Vista and 7?

Tnx.

Link to comment
Share on other sites

I found it. Here is an xml sample for Vista and 7. Save and name it locale.xml and put it in partition C:

<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend"> 
<gs:UserList>
<gs:User UserID="Current" CopySettingsToDefaultUserAcct="true" CopySettingsToSystemAcct="true"/>
</gs:UserList> 
<gs:InputPreferences> 
<!--en-US--><gs:InputLanguageID Action="add" ID="0409:00000409" Default="true"/>
<!--remove-es-Int--><gs:InputLanguageID Action="remove" ID="0c0a:0000040a"/>
<!--en-Int--><gs:InputLanguageID Action="add" ID="0409:00020409"/>
<!--zh-CH--><gs:InputLanguageID Action="add" ID="0804:{81D4E9C9-1D3B-41BC-9E6C-4B40BF79E35E}{F3BA9077-6C7E-11D4-97FA-0080C882687E}"/>
<!--zh-TW--><gs:InputLanguageID Action="add" ID="0404:{531FDEBF-9B4C-4A43-A2AA-960E8FCDC732}{761309DE-317A-11D4-9B5D-0080C882687E}"/>
<!--jp-JP--><gs:InputLanguageID Action="add" ID="0411:{03B5835F-F03C-411B-9CE2-AA23E1171E36}{A76C93D9-5523-4E90-AAFA-4DB112F9AC76}"/>
</gs:InputPreferences>
<!-- system locale --><gs:SystemLocale Name="en-US" />
</gs:GlobalizationServices>

Then run this:

control.exe intl.cpl,,/f:"c:\locale.xml"

For XP save and name it locale.txt and put it in partition C:

[RegionalSettings]
Language=0401
LanguageGroup=13
SystemLocale=0401
UserLocale=0401
InputLocale=0409:00000409,0401:00000401

Then run this:

rundll32 shell32, Control_RunDLL intl.cpl,,/f:"c:\locale.txt"

I'm writing the code to automate this process. I'll post it when it's done.

Link to comment
Share on other sites

  • 1 year later...

I found it. Here is an xml sample for Vista and 7. Save and name it locale.xml and put it in partition C:

<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend">
<gs:UserList>
<gs:User UserID="Current" CopySettingsToDefaultUserAcct="true" CopySettingsToSystemAcct="true"/>
</gs:UserList>
<gs:InputPreferences>
<!--en-US--><gs:InputLanguageID Action="add" ID="0409:00000409" Default="true"/>
<!--remove-es-Int--><gs:InputLanguageID Action="remove" ID="0c0a:0000040a"/>
<!--en-Int--><gs:InputLanguageID Action="add" ID="0409:00020409"/>
<!--zh-CH--><gs:InputLanguageID Action="add" ID="0804:{81D4E9C9-1D3B-41BC-9E6C-4B40BF79E35E}{F3BA9077-6C7E-11D4-97FA-0080C882687E}"/>
<!--zh-TW--><gs:InputLanguageID Action="add" ID="0404:{531FDEBF-9B4C-4A43-A2AA-960E8FCDC732}{761309DE-317A-11D4-9B5D-0080C882687E}"/>
<!--jp-JP--><gs:InputLanguageID Action="add" ID="0411:{03B5835F-F03C-411B-9CE2-AA23E1171E36}{A76C93D9-5523-4E90-AAFA-4DB112F9AC76}"/>
</gs:InputPreferences>
<!-- system locale --><gs:SystemLocale Name="en-US" />
</gs:GlobalizationServices>

Then run this:

control.exe intl.cpl,,/f:"c:locale.xml"

For XP save and name it locale.txt and put it in partition C:

[RegionalSettings]
Language=0401
LanguageGroup=13
SystemLocale=0401
UserLocale=0401
InputLocale=0409:00000409,0401:00000401

Then run this:

rundll32 shell32, Control_RunDLL intl.cpl,,/f:"c:locale.txt"

I'm writing the code to automate this process. I'll post it when it's done.

I found it. Here is an xml sample for Vista and 7. Save and name it locale.xml and put it in partition C:

<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend">
<gs:UserList>
<gs:User UserID="Current" CopySettingsToDefaultUserAcct="true" CopySettingsToSystemAcct="true"/>
</gs:UserList>
<gs:InputPreferences>
<!--en-US--><gs:InputLanguageID Action="add" ID="0409:00000409" Default="true"/>
<!--remove-es-Int--><gs:InputLanguageID Action="remove" ID="0c0a:0000040a"/>
<!--en-Int--><gs:InputLanguageID Action="add" ID="0409:00020409"/>
<!--zh-CH--><gs:InputLanguageID Action="add" ID="0804:{81D4E9C9-1D3B-41BC-9E6C-4B40BF79E35E}{F3BA9077-6C7E-11D4-97FA-0080C882687E}"/>
<!--zh-TW--><gs:InputLanguageID Action="add" ID="0404:{531FDEBF-9B4C-4A43-A2AA-960E8FCDC732}{761309DE-317A-11D4-9B5D-0080C882687E}"/>
<!--jp-JP--><gs:InputLanguageID Action="add" ID="0411:{03B5835F-F03C-411B-9CE2-AA23E1171E36}{A76C93D9-5523-4E90-AAFA-4DB112F9AC76}"/>
</gs:InputPreferences>
<!-- system locale --><gs:SystemLocale Name="en-US" />
</gs:GlobalizationServices>

Then run this:

control.exe intl.cpl,,/f:"c:locale.xml"

For XP save and name it locale.txt and put it in partition C:

[RegionalSettings]
Language=0401
LanguageGroup=13
SystemLocale=0401
UserLocale=0401
InputLocale=0409:00000409,0401:00000401

Then run this:

rundll32 shell32, Control_RunDLL intl.cpl,,/f:"c:locale.txt"

I'm writing the code to automate this process. I'll post it when it's done.

Can you please explain the xml script for windows 7 thank you
Link to comment
Share on other sites

  • 2 months later...

@SolidSnake: follow the guides and examples here, and you should be able to figure it out:

http://blogs.msdn.com/b/michkap/archive/2006/05/30/610505.aspx

http://msdn.microsoft.com/en-ie/goglobal/bb964650%28en-us%29.aspx

The hardest thing (for me at least) is to find out about all the enumerations.

There is an excellent tool if you wish to dive into the deep end of this pool: http://www.flounder.com/localeexplorer.htm

I am just a hobby programmer, and nothing great to publish right now.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...