-
Install Python[https://www.python.org/downloads/windows/]
-
Create a directory to contain your scripts.
-
Add your created directory to your path.
-
Start Menu
-
Type in "environment" and select "Edit Environment variables for your account".
-
In the upper group titled "User variables for [YOUR NAME]" click the "New…" button.
-
Enter your desired variable name (standard is to be in all caps, use underscores instead of spaces, and only letters. E.g. WILLS_PYTHON_SCRIPTS)
-
Enter the path to your script dir as the Variable Value. Click the "OK" button.
-
From the upper group titled "User variables for [YOUR NAME]" select the entry whose value in the "Variable" column is "Path". Click "Edit".
-
From the upper right of the resulting dialog, Click "New".
-
In the new entry type in the name of the variable you just created, surrounded by percentage marks (E.g. %WILLS_PYTHON_SCRIPTS%)
-
Click "OK". When the dialog closes, Click "OK" on the parent "Environment Variables" dialog as well.
-
-
Add a python script in your created directory. E.g. test.py
-
Open a new command prompt and type in the name of your test script, E.g.
test.py
-
Add the script below if desired, changing the SCRIPT_DIR_ENV_VAR constant value to reflect the name of your own script dir variable value (E.g. WILLS_PYTHON_SCRIPTS)
import os
from pathlib import Path
SCRIPT_DIR_ENV_VAR = 'WILLS_PYTHON_SCRIPTS'
SCRIPT_DIR = os.environ[SCRIPT_DIR_ENV_VAR]
if __name__ == "__main__":
print('\n'.join(os.listdir(SCRIPT_DIR)))