1import sys
2print("This is the name of the script:", sys.argv[0])
3print("Number of arguments:", len(sys.argv))
4print("The arguments are:" , str(sys.argv))
5
6#Example output
7#This is the name of the script: sysargv.py
8#Number of arguments in: 3
9#The arguments are: ['sysargv.py', 'arg1', 'arg2']
1simple python commands
2
3print("your text here")
4
5-----------------------------
6
7name = input("what is your name")
8print("nice to meet you " + name)
9
10-----------------------------
11
12A = int(input("give me the first num "))
13B = int(input("give me the second num "))
14f = A + B
15print(f)
1import argparse
2import sys
3
4parser = argparse.ArgumentParser(description="Does some awesome things.")
5parser.add_argument('message', type=str, help="pass a message into the script")
6
7if __name__ == '__main__':
8 args = parser.parse_args(sys.argv[1:])
9 print args.message
1# Create a .bat file with the name of your command, e.g. main.bat
2@echo off
3python %~dp0/main.py %*
4# Then add the current directory to the System Path variable
5# e.g.
6C:\Users\CURRENT\Documents\PythonCommand