Skip to content

Instantly share code, notes, and snippets.

@ijprest
Created March 18, 2015 20:53
Show Gist options
  • Save ijprest/faf7be1b8ec7c5cf5156 to your computer and use it in GitHub Desktop.
Save ijprest/faf7be1b8ec7c5cf5156 to your computer and use it in GitHub Desktop.
param(
[int]$Delay = 0
)
$Win32 = Add-Type -Name WinAPICall -Namespace SystemParametersInfo -PassThru -MemberDefinition @'
[DllImport("user32.dll", EntryPoint = "SystemParametersInfo")]
public static extern bool SystemParametersInfo(uint uiAction, uint uiParam, uint pvParam, uint fWinIni);
'@
if($Win32::SystemParametersInfo(0x17,$delay,$null,0)) {
Write-Host "Keyboard delay changed to: $delay"
} else {
Write-Host "There was an error while changing the keyboard delay."
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment