Last active
March 5, 2024 10:13
-
-
Save TakashiSasaki/3f66b1090705dd3008d8d29bd40c3abe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file is saved in UTF-8 with BOM when uploading to Gist. | |
Write-Output "This file is saved in UTF-8 with BOM when uploading to Gist." | |
# But it is recommended to save in UTF-16 LE if possible. | |
Write-Output "But it is recommended to save in UTF-16 LE if possible." | |
Add-Type -TypeDefinition @" | |
using System; | |
using System.Runtime.InteropServices; | |
public class WinAPI { | |
[DllImport("kernel32.dll")] | |
public static extern int GetUserDefaultLCID(); | |
[DllImport("kernel32.dll")] | |
public static extern uint GetACP(); | |
} | |
"@ | |
$locale = [WinAPI]::GetUserDefaultLCID() | |
Write-Output "---------------------------------" | |
# Locale obtained via kernel32.dll | |
Write-Output "Locale obtained via kernel32.dll" | |
Write-Output "Current Locale (kernel32.dll): $locale" | |
$codePage = [WinAPI]::GetACP() | |
Write-Output "-------------------------------------" | |
# Code page obtained via kernel32.dll | |
Write-Output "Code page obtained via kernel32.dll" | |
Write-Output "Current Code Page (kernel32.dll): $codePage" | |
# Get the current encoding | |
$currentEncoding = [System.Text.Encoding]::Default | |
# Display the code page | |
Write-Output "----------------------------------" | |
# Code page information by .NET Framework | |
Write-Output "Code page information by .NET Framework" | |
Write-Output $currentEncoding | |
# Get the current culture | |
Write-Output "------------------------------" | |
# Culture information by .NET Framework | |
Write-Output "Culture information by .NET Framework" | |
$currentCulture = Get-Culture | |
# Display the culture | |
Write-Output $currentCulture | |
Write-Output "----------" | |
Write-Output "CLRVersion" | |
$PSVersionTable.CLRVersion | |
Write-Output "---------" | |
Write-Output "PSVersion" | |
$PSVersionTable.PSVersion | |
# Pause until the user presses any key | |
# Read-Host "Press any key to continue after checking the result" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment