Sublime Text from Command Line

Windows Command Prompt

For Windows cmd.exe you could just add the sublime text installation directory to your PATH environment variable, this would allow you to type:

sublime_text file.rb

Personally, I add a doskey (in a .bat file set to autorun with cmd) so I can type subl file.rb:

> doskey subl="C:\Program Files\Sublime Text 2\sublime_text.exe" $*

Cygwin

For the default bash shell add an alias to your ~/.bashrc file, e.g:

$ echo 'alias subl="/cygdrive/c/Program\ Files/Sublime\ Text\ 2/sublime_text.exe"' >> ~/.bashrc

Leave a Comment