I seem to be having a problem with executing a Python script from a Win+R terminal.
I completed the following steps:
Used the shebang line before typing my script for all .py files. An example of what I did below for a script called
Primefactorization.py
.#! python3
I created a batch file in the same folder with the same name and input the following code:
@python.exe C:\Python Scripts\Primefactorization.py %*
I added the path (
C:\Python Scripts
) to thePATH
variable in the environment variables window.When I try to invoke the script using the Run command in Windows 7, the shell opens and immediately disappears.
Based on a past answer to a similar problem on Stack Overflow, I also added the following code prompting the user for input before exiting. But that doesn't seem to work.
x = input('press enter to close')
Could you please let me know where the problem might be?