Code Monkey home page Code Monkey logo

ctrlcenabler's Introduction

Ctrl+C Enabler for PowerShell

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" from release 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 the SetConsoleCtrlHandler Win32 API.

public static bool EnableCtrlC()
{
    return SetConsoleCtrlHandler(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.

ctrlcenabler's People

Contributors

jsakamoto avatar stknohg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.