I want to run my program if I type a specific command.
My Python program should take the test file as a command line argument. For example in the command prompt or the terminal, my program should run if you type “python my_program.py test.txt”.
Open command prompt, make sure you are in the right directory. If you are on windows you can simply hold shift and right click the folder and open command line here. If not you can just manually navigate to the directory by using the cd (change directory) command.
Type python my_program.py test.txt and it will work.
How to run a program by typing a specific command