0
Follow
0
View

cmd user-defined file command problem

easonlele 注册会员
2023-02-25 18:11

the reference answer GPT ᴼ ᴾ ᴱ ᴺ ᴬ ᴵ < br / > to the executable file name can be used directly on the command line, need to add it to the system PATH environment variable. This way, when you type the executable file name on the command line, the operating system will look for the file in the PATH path and execute it.

In Windows, you can follow these steps to add an executable file to the PATH environment variable of the system:

  1. In Windows Explorer, locate the folder where your executable Eric.exe resides.

  2. Type cmd on the address bar and press Enter to open a command prompt window.

  3. type setx path "%path% in the command prompt window; Folder path "(note that the folder path is replaced with the absolute path of the folder where Eric.exe resides) and press Enter to execute this command.

  4. Close the command prompt window and reopen a new command prompt window.

Now you can run the executable by typing Eric or Eric -m xxx on the command line.

Also, if you want the executable to support command-line arguments, you can parse and process them in your Python program using the argparse module. Refer to the Python official documentation for specific usage: https://docs.python.org/3/library/argparse.html

About the Author

Question Info

Publish Time
2023-02-25 18:11
Update Time
2023-02-25 18:11