2

I'm working on trying to get a shortcut to work to where I press my hotkeys "Ctrl + Alt + H" to run a batch file that hibernates my computer in 4 minutes. The batch file works and the shortcut, when I double press that, it also runs the batch file and still works. The only problem is the hotkeys are not starting the shortcut.

Here is my setup that I have for this

Image of Set up

  • Have you attempted the key to start cmd.exe D:\...\...\*.bat? Try that. (Obviouly the path being the above mentioned. – DankyNanky Feb 5 '17 at 9:31
  • Everything works besides the hotkey for the shortcut. I placed the shortcut with the assigned shortcut in both desktop and start menu and it will only work if I have windows explorer open to the startmenu which I want to be able to use the hotkey at anytime. – Kayracer Feb 5 '17 at 17:18
2

Updated: I tested it moving a shortcut sequentially to different folders and surprisingly it works only in following folders (might not be complete):

  • Desktop: %USERPROFILE%\Desktop
  • Common Desktop: C:\Users\Public\Desktop
  • Common Start Menu: %ProgramData%\Microsoft\Windows\Start Menu
  • Common Programs: %ProgramData%\Microsoft\Windows\Start Menu\Programs
  • Accessories: %appdata%\Microsoft\Windows\Start Menu\Programs\Accessories

Moreover, I had to open Properties of a moved shortcut to

  • refresh the hotkey for the shortcut by setting it to anything else and then back to final hotkey CtrlAlt+H, and
  • change shortcut target (only in some of folders mentioned above)
    • from "D:\bat files\my Test Script.bat"
    • to cmd /c "D:\bat files\my Test Script.bat"

FYI, I'm on Windows 8.1 64 bit:

==> ver

Microsoft Windows [Version 6.3.9600]

==> set CommonProgramFiles
CommonProgramFiles=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files

==>

Original answer based on Shortcut key for shortcut does not work Microsoft article:

Symptoms

You are unable to run a shortcut by pressing its shortcut key.

Cause

Shortcut keys work only for shortcuts on the desktop or in the Start menu hierarchy.

Resolution

Make sure that the shortcuts for which you want to use shortcut keys are on the desktop, on the Start menu, or in the Windows\Start Menu\Programs folder.

More Information

Shortcut keys work differently depending on the location of the shortcut. If the shortcut is on the desktop or in the Start menu hierarchy, you can use its shortcut key to start the assigned program, or switch to the program if it is already running.

If the shortcut is not on the desktop or in the Start menu hierarchy, you cannot use its shortcut key to start the assigned program, but you can use its shortcut key to switch to the assigned program if it is already running.

NOTE: Shortcut keys may not work for some programs. For example, shortcut keys do not work for items on the Quick Launch bar.

  • I got it to work only if I have the file explorer to be open in Windows\Start Menu\Programs folder and still doesn't work on the desktop unless I have the actual properties windows open – Kayracer Feb 5 '17 at 16:51
  • So i edited your target line to /k instead of /c and the output for me was D:\Programs\batch' is not recognized as an internal or external command, operable program or batch file and the line that is in my batch file is START cmd.exe /c "ECHO The computer will hibernate in 4 minutes!! :) & ping -n 240 127.0.0.1 > NUL 2>&1 && shutdown /h /f" – Kayracer Feb 5 '17 at 19:33
  • Shortcut target cmd /c "D:\bat files\my Test Script.bat" (note properly escaped items!) – JosefZ Feb 6 '17 at 7:49
  • @RayceNeal I have approved your edit although… If you set a shortcut target field to cmd /C command or cmd.exe /C command then Windows system would change it to C:\Windows\system32\cmd.exe /c command immediately after clicking Apply button. To be accurate, C:\Windows\system32\cmd.exe here is evaluated %comspec%. – JosefZ Feb 6 '17 at 20:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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