Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python IDLE from cmd

How to open my .py script from anywhere on my pc directly into python idle form command prompt?

Is there any way so that i can typeidle test.py on cmd so that it opens the test.py file in the current directory and if test.py is not available creates a new file and opens it into idle

like image 994
Aniket Navlur Avatar asked May 01 '26 12:05

Aniket Navlur


2 Answers

You can do that by adding the directory where you have installed the idle editor the PATH environment variable.

How to do that depends on your operating system: just search the Internet for add directory to path plus your operating system: e.g. Windows/Ubuntu, etc.

After changing the environment variable it may be a good idea to restart your PC (to make sure that all programs use the updated version)

like image 200
TmTron Avatar answered May 03 '26 02:05

TmTron


You can right click on the idle then you will can see location of it in the properties tab

Navigate to that location and call as below

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Python 2.7>"IDLE (Python GUI).lnk" C:\Python27\projects\ping.py
like image 45
Sandeep Lade Avatar answered May 03 '26 01:05

Sandeep Lade



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!