Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Ctrl+C Enabler for PowerShell

License

NotificationsYou must be signed in to change notification settings

jsakamoto/CtrlCEnabler

Repository files navigation

Summary

This is a .NET class library that allows you to enable Ctrl+C break on PowerShell console, always.

Why should be use this?

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 :)

How to install in your PowerShell?

  1. Download "CtrlCEnabler.dll" fromrelease page, and save it into "%HOME%\Documents\WindowsPowerShell" folder.
  2. Open the PowerShell console and enter the following command:
PS> notepad$PROFILE
  1. Then, the file "Microsoft.PowerShell_profile.ps1" is opened in a text editor.
  2. Append lines as follows at the bottom of "Microsoft.PowerShell_profile.ps1", and save it.
# 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.

How does it work?

This class library just calls theSetConsoleCtrlHandler Win32 API.

publicstaticboolEnableCtrlC(){returnSetConsoleCtrlHandler(null,false);}

See also:

LICENSE

The Unlicense

Appendix

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.


[8]ページ先頭

©2009-2025 Movatter.jp