How to Open Files from Your Command Prompt with Sublime Text 2

by on March 8, 2012 in
How to Open Files from Your Command Prompt with Sublime Text 2 Difficulty Level: Beginner
 

This is how to add any executable (.exe) to your Window’s Command Prompt. I created a new instance of sublime_text.exe so I wouldn’t have to rename it (and therefore cause problems with other stuff).

Wellington Cordeiro was nice enough to share his much better method below:

Here’s a simple similar solution that I used to add a command for Sublime Text 2 (or any other program for that matter.)

First I created a folder in my user folder called batscripts to host the bat scripts I use.

Then I made a script called subl.bat and placed the following line in it.

@START C:\”Program Files (x86)”\”Sublime Text 2″\sublime_text.exe “%1″

Then I just added the batscripts folder to my PATH variable.

Now I can type subl index.html and it’ll launch Sublime Text 2 with the file open for me

 
If you liked this article, you might also like:
  • http://willy1234x1.tumblr.com Wellington Cordeiro

    Here’s a simple similar solution that I used to add a command for Sublime Text 2 (or any other program for that matter.)

    First I created a folder in my user folder called batscripts to host the bat scripts I use.

    Then I made a script called subl.bat and placed the following line in it.

    @START C:”Program Files (x86)”"Sublime Text 2″sublime_text.exe “%1″

    Then I just added the batscripts folder to my PATH variable.

    Now I can type subl index.html and it’ll launch Sublime Text 2 with the file open for me

    • http://pressedweb.com/ Cory

      That’s pretty awesome. It keeps your PATH fairly clean and you don’t have to duplicate executables. Thanks man! I’ll definitely give it a shot and update the post.

  • ash

    damn this was genious thanks