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
function Confirm-Host { | |
<# | |
.SYNOPSIS | |
Prompts the user to OK or Cancel an operation via the host. | |
.DESCRIPTION | |
Prompts the user to OK an operation by hitting ENTER or cancel | |
it by hitting ESC. | |
.EXAMPLE | |
if(Confirm-Host) { ... } | |
.OUTPUTS |
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
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 { |
NewerOlder