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

Python

Repeatedly typing in filepath to cmd

Hi!

I'm using Python in cmd, and am having to repeatedly type in "python test.py", for example, to run my script.

Is there a quicker way of doing this or am I lazy?

Thanks!

Prabhath

2 Answers

Use your keyboards up arrow in the command line, or you can drag the file from the folder into terminal (assuming you are on a Mac/Linux).

Also, an easier method is typing in python first... This will change the default cmd environment to a python environment. After this, instead of prefixing your scripts with "python", you just type in the name of the script. Hope that helps.

thank you so much!