Change Shortcut for closing windows

3

1

How can I change the shortcut for closing windows from Alt+F4 to Ctrl+W in windows.

darthvader

Posted 2011-01-14T14:03:54.817

Reputation: 3 709

3Which version of Windows? – Jeff F. – 2011-01-14T14:06:48.697

1Tell the developers of the application you're using to support this with Ctrl-W. Some applications (even Windows Explorer, if I'm not mistaken) support this. – Daniel Beck – 2011-01-14T14:12:04.130

1Maybe an Autohotkey expert can give you a hand with this. – Mehper C. Palavuzlar – 2011-01-14T14:30:32.547

Answers

1

I think that even an AutoHotkey beginner can do this. The script is as follows:

Alt & F4::
    return
Ctrl & w::
    WinClose, A

But what if you just wanted to close a Word document or a Firefox tab (when Ctrl+W is used as a hotkey), not the whole application?

Andriy Denysenko

Posted 2011-01-14T14:03:54.817

Reputation: 11

1

  1. Download and install AutoHotkey
  2. Create an empty file called shortcuts.ahk
  3. Create a shortcut to that file and put it in the Startup folder
  4. Edit shortcuts.ahk and put this in it:

    ^w::Send ^{F4}

  5. Double click on shortcuts.ahk

Keep in mind that Ctrl+W is used for other things, e.g. in Notepad², it enables word wrap.

See also:

Mikel

Posted 2011-01-14T14:03:54.817

Reputation: 7 890

0

The ideas above are quite good ones and they bring up good points, and learning how to use AutoHotKey is a great idea, as a general matter. You can download the software via http://ahkscript.org/download/ahk-install.exe which is directly linked at the homepage of http://www.autohotkey.com/ .

Keep in mind, that while the default keystroke combination of Alt+F4 will close the ENTIRE program (e.g., Firefox, MSWord, MSExcel) which is sometimes precisely what you want to do, the default keystroke combination of Ctrl+W allows you to close only a certain subwindow or tab of certain programs (e.g., Firefox, MSWord, MSExcel) which is sometimes all you might really intend or want. If you implement an Autohotkey idea like these fellows are suggesting, then BOTH aforementioned keystroke combinations will close the ENTIRE program.

Something else to mention? If you're a novice/sub-intermediate computer user, downloading and using Autohotkey by yourself MIGHT seem a little overwhelming. IF this is the case, then head over to the Autohotkey forums (also at http://www.autohotkey.com/ ), tell them that fellows from superuser.com sent you, request that they provide you with an AHK script that does what you're requesting here, AND ask them (and tell them you're quoting me-- in fact, link them to this superuser thread) to compile the resultant AHK script into a *.exe file. Then, once they give it to you, thank them, and put the new *.exe file in your Windows startup folder.

Also, you can try to talk to them via the #ahk IRC channel on Freenode.

Good luck!

**actually, just a quick follow-up query for the lads above such as @Mikel ... If a person makes an AHK-script that replaces a default keystroke combination like Alt-F4 (as might be requested in this place), are you SURE that the new keystroke combination will replace the old, default one? Just want to verify.

MercWithMouth

Posted 2011-01-14T14:03:54.817

Reputation: 75