Q: Python, Command Line, Windows NEW Edit. I am using Python2.7.5 in Windows 7. I'm new to command line arguments. I am trying to do this exercise: 
Write a program that reads in a string on the command line and returns a table of the letters which occur in the string with the number of times each letter occurs. For example:
 $ python letter_counts.py "ThiS is String with Upper and lower case Letters."
 a  2
 c  1
 d  1
 # etc.

I have some fundamental problems: How do I add strings to the command line?
I went to Control Panel and altered the Path (adding ;C:\Python27) 
Now I'm in cmd.exe
This gets the right answer 
 >>>python
 Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32
 Type "copyright", "credits" or "license()" for more information.

However these get SyntaxError: invalid syntax:
 python letter_counts.py
 C:\Python27\python.exe
 C:\Python27\pythonw.exe  
 C:\Python27\python.exe .\letter_counts.py 

Any suggestions? thank you! 

A: After modifying your path, did you start up a new instance of the command prompt (this has caused me much grief in the past)?  To check if your path change was successful:
echo %PATH%

and check to see if C:\Python2.7.5 was appended to it.
If not then run:
set PATH=%PATH%;C:\Python2.7.5

To call a python script with a command line argument (assuming that your script is in the current working directory):
python letter_counts.py "Your Text Goes Here"

OR if you just want to be overly verbose (or your PATH still isn't right):
C:\Python2.7.5\python.exe .\letter_counts.py "Your text still goes here"

EDIT:
Make sure you are doing this from the command prompt and not the python interpreter.  To access the command prompt you can hit: 
1. Windows Key + R
2. type "cmd" (without quotes) and hit enter


A: In response to your question on 'adding strings to the command line'.
import sys
print sys.argv

will give you the command line args you passed in. In your case, it looks like you want the first argument, so you would do something like:
print sys.argv[1]

note that sys.argv[0] will give you the filename you passed into python, so you actually want [1] in this case.
I don't use Windows, but if you want an easy setup python environment you could look into ActivePython perhaps. Worst case or as a temporary solution you could just go to the folder where python.exe is located and run your scripts there.
