Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question
3  
Which version of Windows? –  Jeff F. Jan 14 '11 at 14:06
1  
Tell 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 Jan 14 '11 at 14:12
1  
Maybe an Autohotkey expert can give you a hand with this. –  Mehper C. Palavuzlar Jan 14 '11 at 14:30

3 Answers 3

  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:

share|improve this answer

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?

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.