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

5,670

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",
        "command":"exec",
        "args": {"cmd": "c:\\drive\\1file\\cp.bat"}
    }
]

Adding a hot-key (third step):

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

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

Share:
5,670

Related videos on Youtube

Aminadav Glickshtein
Author by

Aminadav Glickshtein

Started coding at the age of seven, with the ability to program as if it were a native language. Has in-depth knowledge of software development, cloud, big data, web, desktop, cybersecurity, blockchain, DevOps and mobile development. Latest innovation: Control V

Updated on September 18, 2022

Comments

  • Aminadav Glickshtein
    Aminadav Glickshtein over 1 year

    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)