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

making a directory

Every time i try make a directory on cmd i get access in denied. i am typing in mkdir [directory_treebook]

4 Answers

Nathan Bubis -

If by a PC, you mean you are using Windows as your OS use open up the powershell console instead of cmd console and that should get you going.

If you need more help getting started with the command line on Windows check out this crash course in the command line

More info on why it's easier just to use powershell when following along with this course on Windows.

By default powershell starts with a working directory of the user's profile, which by default the user already has access to. Also powershell supports ls as an alias for dir which eliminates another common issue.


Note: In powershell you have to prepend $env: to access an environmental variable. For example to go to your profile folder use cd $env:userprofile.

Assuming your typing something like:

mkdir my_new_directory

That should be fine. Where are you trying to create the directory? If you are not sure what you're doing you want to try it out under the home directory. Because you have permission to do what you want under the home directory. To get to home do the following command at the terminal cd

Then type mkdir my_new_directory

If you need to make the directory but don't have permissions you can use : sudo mkdir my_new_directory Then enter your user password

this didn't work when i tried mkdir my_new_directory i got access denied i'am using a pc

Ah, well that's your problem. Using the DOS box is completely different from a POSIX based system like Linux, Unix or the Mac. Treehouse has a video where they explain this: http://teamtreehouse.com/library/programming/console-foundations/getting-started-with-the-console/introduction

Basically,the advice was you don't want to try UNIX commands on the PC. Now, if you want to make a directory on a PC it is md. ;-)

md my_new_directory

Rich

Richard Wigley

That's incorrect, mkdir is a valid Windows command. md is merely an alias for mkdir

It's important to understand what an error message is telling you, permission denied errors don't happen if you type in an unrecognized command.

That will learn me... Thanks James.

Rich

Richard Wigley - Your advice on difference between commands for Linux/OS X and Windows is spot on though. Treehouse is kinda mac-centeric so they sometimes forget to mention in the videos when things are different on Windows and trying Linux commands on Windows will be obviously fruitless. Though the command to create a directory is not one of those cases :wink:

UAC is blocking you from making it, but without a popup message since it's the command line. Try to avoid creating folders in the program files or program files x86 directories. Instead just make a project folder right in C:. Things should work then.