Ctrl+C Enabler for PowerShell
This is a .NET class library that allows you to enable Ctrl+C break on PowerShell console, always.
In some case, a PowerShell console, which is launched from Visual Studio IDE external tools menu, doesn’t accept Ctrl+C.
This class library can fix it :)
PS> notepad $PROFILE
# Enable Ctrl+C force.
Add-Type -Path "$env:HOME\Documents\WindowsPowerShell\CtrlCEnabler.dll"
[CtrlCEnabler]::EnableCtrlC() > $null
After this instruction, the PowerShell console always enables Ctrl + C break, even when launched from Visual Studio’s external tools menu.
This class library just calls the SetConsoleCtrlHandler
Win32 API.
public static bool EnableCtrlC()
{
return SetConsoleCtrlHandler(null, false);
}
See also:
In some case, a PowerShell console, which is launched from Visual Studio IDE external tools menu, doesn’t accept Ctrl+C.
A PowerShell console, which launced by “Open Command Line” Visual Studio IDE Add-in, is alyways available Ctrl+C break.