Python Forum
How do I run python scripts from any directory using Windows command prompt?
Thread Rating:
  • 2 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do I run python scripts from any directory using Windows command prompt?
#1
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.
Reply


Messages In This Thread
How do I run python scripts from any directory using Windows command prompt? - by bigmit37 - Jun-14-2017, 12:32 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  'pip' not recogmnized in windows prompt MaartenRo 1 458 Dec-21-2023, 09:05 AM
Last Post: menator01
  working directory if using windows path-variable chitarup 2 820 Nov-28-2023, 11:36 PM
Last Post: chitarup
  Trying to us python.exe from our network to run scripts cubangt 3 951 Aug-17-2023, 07:53 PM
Last Post: deanhystad
  What is the difference between Command Prompt and Sublimes yaoyao22 1 703 Jul-09-2023, 02:56 PM
Last Post: snippsat
  [SOLVED] [Windows] Right way to prompt for directory? Winfried 4 2,138 Jan-17-2023, 09:28 PM
Last Post: markoberk
  Open windows cmd prompt and run cmds with python Extra 3 1,515 Jul-14-2022, 06:07 AM
Last Post: Gribouillis
  Facing Problem while opening a file through command prompt vlearner 4 2,010 Jan-30-2022, 08:10 AM
Last Post: snippsat
  Running python scripts from github etc pacmyc 7 3,838 Mar-03-2021, 10:26 PM
Last Post: pacmyc
  Noob warning: trying to use pip to install pytest and pep8 in Command Prompt adifrank 4 5,474 Dec-20-2020, 04:23 AM
Last Post: adifrank
  Running Python in Command Prompt Anwar 3 3,173 Nov-15-2020, 03:15 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020