Python Forum

Full Version: How do I run python scripts from any directory using Windows command prompt?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
The default directory I'm usually in when I start up Windows command prompt is C:\Users\Moon\, which I'm content with.

I have some folders located in the directory C:\Users\Moon\AppData\Local\Programs\Python\Python36\
such as 'data scripts', deep learning scripts etc
They each contain different scripts.

I don't want to type in the whole directory nor change the directory, when I try to run from the command prompt:

python3.6 C:\Users\Moon\AppData\Local\Programs\Python\Python36\data scripts\data.py

python3.6 C:\Users\Moon\AppData\Local\Programs\Python\Python36\deep learning\NLP.py


Is there a way to shorten this to something like without changing directories?

python3.6" \deep learning\NLP.py"

python3.6 "\data scripts\....."

or maybe just shorten it in general?


Thank you.
(Jun-14-2017, 12:32 AM)bigmit37 Wrote: [ -> ]I have some folders located in the directory C:\Users\Moon\AppData\Local\Programs\Python\Python36\
In part-1 look at a better location that the long default one.
Quote:I don't want to type in the whole directory nor change the directory, when I try to run from the command prompt:
In part-2 use of cmder can jump straight into any folder from file-explorer.
cmder also has a history of what is typed before(thisĀ i use all the time),just use arrow key.
That link is for older version of Python Ofnuts.
Python has changed the whole Windows installer for Python 3.6,PATH is added under installation.
That what i addresses in tutorial that i have linked to.
The best solution is cmder as Snippsat suggests.
I started using it when he first suggested it to me. Very useful for very many things.
is can be called up simply with a right click in any directory and
python run immediately just by typing 'python' at the command line.
Highly recommended