How to create new command to execute a batch file with Sublime Text


I need to create a new "shortcut" command in Sublime Text to run a BAT file.

I know how to use build_systems and even build_systems per project.

I want to add the command to the command palette list (in the image), and to bind a hot-key for that.

enter image description here

How do I do that?

(I'd prefer not using Python for this)

Best Answer

  • Here is my answer for this:

    The steps to follow

    • Install edit-command-palette plugin for Sublime Text (it is easy, so I won't describe how);
    • Edit the command file: from menu "Preferences" select "Command - User";
    • Edit the key bindings file to add hotkeys: menu "Preferences" select "Key Bindings - User".

    The command file (second step):

            "caption": "moyshale",
            "args": {"cmd": "c:\\drive\\1file\\cp.bat"}

    Adding a hot-key (third step):

    "keys": ["ctrl+shift+y"],
            "args": {"cmd": "c:\\drive\\1file\\cp.bat"}

    (It's basically the same, just needs to change keys and caption)