Sublime Forum

Can't seem to open Sublime Text 3 with cmd win 10

#1

I am just starting the Ruby on Rails, and working in the command prompt the subl cmd says its not recognized as an operable program. I did look thru environment variables but unable to find problem. Found alot for OS, but I have win 10.
Thanks

0 Likes

#2

You will need to add the location that sublime is installed in to the PATH environment variable.

I don’t use windows 10 so I don’t know offhand how to do that, but this superuser answer seems to cover it; note however that this apparently will not work for non-administrator accounts, so if you’re not an administrator you may need to log in with the admin account to do this.

To find the location to add you should be able to do something like right click on the shortcut to sublime text and pick Properties, then pull the path (without the exe name on the end) out (assuming Windows 10 still shows that sort of thing).

1 Like

#3

I have put a sublime text folder into variables and pasted the program files there. I then edit the user variable and added sublime at the end of the PATH following the ruby installer. And apparently I haven’t configured it right. Not sure how to proceed. I do realize the path is wrong. Thank you for your help though.

0 Likes

#4
  • A shorter way is by hitting WINR, typing SystemPropertiesAdvanced and hitting Enter.
  • Then select the button Environment variables.
  • Select path in the list from the top and select Edit button.
  • Make your changes and save to proceed.

I believe you shouldn’t add the whole folder but only subl.exe, which will forward calls you make to subl in the command prompt to sublime_text.exe.


@Linda58 I would recommend using a different setup:

1 Like

#5

Here is what I have
In the System variable
SUBLIME C:\Program Files\SublimeText3

In User variable
C:\Ruby23-x64\bin
C:\Railsinstaller\Git\cmd
C:\Railsinstaller\Ruby2.2.0\bin
C:\Sublimetext3\subl.exe

I don’t know where I am failing to complete the path…

0 Likes

#6

Are you sure that the path is C:\Program Files\SublimeText3 and not C:\Program Files\Sublime Text 3? (that is; should there be spaces in the name of Sublime Text 3? On my windows machine that’s where it is installed, so that might be part of the problem.

I’m not sure what you mean by “User Variable” here, but I think what you want to do is add the value that you have as SUBLIME above (the one that might need spaces in it) to the path. If that’s what the “User Variable” means, you might try adding it there (without the subl.exe part) and see if that helps.

Again, I’m not 100% sure how different Win10 might be from older versions of windows, but assuming it’s similar in this regard, the PATH variable provides a list of directories (separated from each other by commas) that specify where to look for programs when you try to run them.

So if you try to run subl or sublime_text (both in the same directory), it would walk through the list of paths checking to see if it can find the program there, and then run it.

2 Likes

#7

According to this page you could also use %ProgramFiles%\Sublime Text 3 instead of C:\Program Files\Sublime Text 3.

What surprises me in your example, is that you have a link to C:\Program Files\Sublime Text 3 and to C:\Sublime Text 3\subl.exe! I’m pretty sure that one is wrong, probably the second if we follow along @OdatNurd 's comment. I have never used the installed version of ST on windows, only the portable versions.


Another comment on your system variable.

If you add the Sublime Text folder C:\Program Files\Sublime Text 3 to the environment variables, Sublime Text will be automatically available via the command line as either subl (via subl.exe in the folder, which forwards commands to sublime_text.exe) or sublime_text itself. So that would be shorter than typing sublime every single time.

If you do not add the whole target folder to environment variables, but subl.exe directly then (1) sublime_text won’t be a valid command in the command line and (2) you’ll still have the commands from subl forwarded from the subl.exe to the sublime_text.exe. This again gives you the shorter command subl.

I hope that wasn’t too confusing, I would recommend two things in your setup:

  • fix the typo in the environment variables as @OdatNurd said, by either (1) targeting the Sublime Text folder or (2) the subl.exe directly
  • get rid of the system variable SUBLIME C:\...... cause really you don’t need it. subl is shorter and there’s no special setup required on your end.
0 Likes

#8

rppn, I just wanted to thank you for your suggestions. I really at first didn’t understand the PATH directions. But after watching a few utube videos, I see where using notepad the instructor used that PATH narrative. The class on Lynda doesn’t use that narrative so I had no clue as to your points. But I do now and will consider changing things around. So thanks again.

1 Like