Search code examples
powershellautomationscriptingautohotkeyhotkeys

How to write an AHK script that uses a shortcut to close PowerShell?


I've known that Alt+Space C could close PowerShell, but Alt+Space is already in use for me, I want to bind Alt+F4 to Alt+Space C, how to achieve that in AHK?


Solution

  • The following script enables using Alt+F4 or Ctrl+D to close PowerShell:

    #IfWinActive ahk_exe powershell.exe
      !F4::
      ^d::WinClose
    #IfWinActive