Sammy
Sammy

Reputation: 57

How to run a python script in IDLE using CMD prompt

I am wondering if there is a way to open a python script in IDLE run mode, (the equivalent of opening it with idle.exe {path} and pressing F5) or set it up so that if a .py file is open with IDLE it automatically runs it.

#Opens without IDLE GUI
python {path}
#Opens in IDLE, but in editor mode
@ECHO OFF
idle.exe {path_to_idle}

Upvotes: 0

Views: 103

Answers (1)

Nikolaj Kiel
Nikolaj Kiel

Reputation: 86

# Running script.py in idle
idle.exe -r script.py

You might consider using:

# Inspect interactively after running script (see "python --help" from cmd)
python -i script.py

Upvotes: 1

Related Questions