Set a keyboard shortcut for a Windows CMD command?

9,115

You don't have to write a batch file. Just create a shortcut of taskkill.exe on desktop and modify the shortcut to have the arguments you use on "Target" field. If you want to be cooler, change the attribute of that shortcut to "hidden" and the keyboard shortcut will still work. Just don't forget that you made this hidden shortcut; or you'll be in trouble when you want to remove that keyboard shortcut. I've been using this way on Windows 7 and I believe that this is still valid on Win8.

To make that hidden shortcut visible again, you may use command prompt + "attribute -R" command, or change the folder option on Windows Explorer.

Share:
9,115

Related videos on Youtube

mxrclxst
Author by

mxrclxst

Updated on September 18, 2022

Comments

  • mxrclxst
    mxrclxst over 1 year

    I'm running Windows 8.1 Pro and would like to know if it's possible to have a keyboard shortcut to run

    taskkill /F /FI "STATUS eq NOT RESPONDING"
    

    using "CTRL + ALT + X"

    SIDE NOTE: I have currently have a work-around where I have a batch file (KillTask.bat) with the command and a desktop shortcut to KillTask.bat with the shortcut key set to CTRL+ALT+X.

    Screenshot (Here's a screen-shot explaining the work-around)

    Is there a more direct method of doing this by way of a keyboard shortcut without the use of desktop shortcuts and batch file?

    • ssnobody
      ssnobody over 9 years
      Autohotkey can do it, but its more complicated than your current solution.
  • Jonathan
    Jonathan over 7 years
    Does this work on Windows 10? I just tried and it didn't work?
  • Scott Rhee
    Scott Rhee over 7 years
    @Jonathan // Try these - 1. Windows 10 has more reserved shortcut keys ever that you can't use for this. So try again with another combination. Test it before making the shortcut hidden. 2. Create a batch file to do the same thing, confirm that it works and then create a shortcut to that batch file to ensure that your taskkill syntax is correct.