Reputation: 25
as explained in my question, yupp, I'm looking for a yes/no answer to it, if possible could someone direct me to a way to do so?
Basically, I'm aware of the thread "How to set up keyboard shortcuts from windows command line?" but nircmd's shortcutkey cmd as suggested in the thread isn't working so i'm looking for an alternative to do so.
TO CLARIFY Do note that I'm aware of the manual way to assign a shortcutkey in windows like clicking into properties and setting it, but i'm looking for a cmd line or .bat way :) THANKS!
Do advise :) thanks in advance!!!
Upvotes: 0
Views: 103
Reputation: 67090
You can't do it directly using cmd.exe
commands (without 3rd party tools) but you can create a small VBScript script for that.
Methods for Shell interoperability are in the ActiveX object WScript.Shell
and method you need is CreateShortcut
:
Shell = new ActiveXObject("WScript.Shell");
link = Shell.CreateShortcut("Shortcut file name.lnk");
link.TargetPath = "path to your program";
link.Arguments = "program arguments";
link.Description = "shortcut description";
link.Hotkey = "CTRL+SHIFT+M";
link.Save();
Save this code in a file .vbs file and execute it once, it'll create your shortcut and it'll be available immediately. Note that there are more properties you can set (icon, window style, working directory and so on), just refer to MSDN for WshShortcut
object documentation.
Upvotes: 1