Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby Ruby Foundations Methods Instance Methods

touch and subl are not recognized in command prompt

I've just created and moved into the Source\methods\ folder, but am stuck at the very next step: touch simple_methods.rb and subl simple_methods.rb are not recognized as internal or external commands, operable programs, or batch files. I'm working on the Windows prompt. Any solutions?

Sophia Harrison
Sophia Harrison
4,534 Points

Touch should work on Windows; it worked on mine. To solve the subl issue just use notepad, in which case just enter "notepad" before the rest of the file command.

5 Answers

I am not terribly familiar with this project, but perhaps this may be helpful. touch some_file is a Unix command that creates a new file called some_file. Additionally, subl some_file opens some_file in the text editor Sublime Text.

If you are on Windows, the touch command would not work. Furthermore, I do not think Sublime Text has a subl command for Windows.

I am not familiar with the command-line on Windows, but I found this thread on stack overflow that might help, it looks like a command you can use to create a file would be type NUL > simple_methods.rb As far as editing that file, you may just need to find it and open it in a text editor using the file system, especially if you use a text editor that cannot be launched from the command line.

Hope this helps!

Thanks! Yeah, I'm just now starting to find the inconvenience of Windows not being unix-based.

Also if you really want to have some unix commands you can consider getting git bash. It comes from git for windows.. it will add a context to your right click menus "git bash here" or similar.. and within it you will get a set of "bash" commands that may be more friendly (much friendlier than DOS)

Git bash uses unix like slashes too.. so this is my desktop /c/Users/my_username/Desktop

windows way: c:\Users\my_username\Desktop

-------------tip: if you want more advanced.. and you actually wanted to make any unix like aliases for example "subl"

after running git bash cd edit the .bashrc file in there in whatever way you can (even notepad) add this one line somewhere (bottom of file is fine) be cautious of the quotes as unix doesn't like "spaces" in directories and need proper escaping

alias subl="/c/\"Program Files\"/\"Sublime Text 3\"/sublime_text.exe"

and you should be able type 'subl' and get sublime text editor to come up

Sherry Parker
Sherry Parker
9,601 Points

I got stuck at the same spot. I found that using Git Bash worked for the touch command but still failed on the subl so I used notepad instead and I am through now. Best of luck.

Antoine Boillot
Antoine Boillot
10,466 Points

Hi all,

To the OS X users : I had the same issue with the "subl" command. I typed the following and it worked fine for me then :

ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/.rvm/bin/subl


Ronnie Barua
Ronnie Barua
17,665 Points

Well unfortunately, it failed for me, and I am a OS X user. Good luck to you!