Powershell: changing the culture of the current session

I am using powershell for Windows Vista. How to change the culture of the current session? My computer culture is tr-TR, so I get error messages in Turkish. I would like to switch to EN?

any chance?

+8
windows powershell windows-vista
source share
1 answer

Have a look here: http://blogs.msdn.com/b/powershell/archive/2006/04/25/583235.aspx

and here: http://poshcode.org/2226 :

function Set-Culture([System.Globalization.CultureInfo] $culture) { [System.Threading.Thread]::CurrentThread.CurrentUICulture = $culture [System.Threading.Thread]::CurrentThread.CurrentCulture = $culture } 

Additional Information

To find out what values โ€‹โ€‹you can use for $culture :

  • This will give you a list of crop types:

     [Enum]::GetValues([System.Globalization.CultureTypes]) 
  • When choosing one of the above types (for example, AllCultures), you can list the available values โ€‹โ€‹of this type:

     [System.Globalization.CultureInfo]::GetCultures( [System.Globalization.CultureTypes]::AllCultures ) 
  • Then you can use the name or number of the culture you are interested in using the GetCultureInfo method to get the value you want:

     $culture = [System.Globalization.CultureInfo]::GetCultureInfo(1033) $culture = [System.Globalization.CultureInfo]::GetCultureInfo('en-US') 

Note. Thanks to the implicit conversion, you can simply pass the name or number of the culture (i.e. as a string or integer) to the Set-Culture method, which will be automatically converted to the expected CultureInfo value.

+13
source share

All Articles