carebear
carebear

Reputation: 771

Syntax error in setting the current directory of command prompt in Windows 7

I saved a python file to my desktop. In order to test it, I used the command prompt. However, my command prompt is located in

C:\Users\Name\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Accessories

To change the current directory, I wrote

cd C:\Users\Name\Desktop

in the command prompt. However, it keeps telling me that I have an "invalid syntax"

>>>cd C:\Users\Name\Desktop
  File "<stdin>", line 1
    cd C:\Users\Name\Desktop
       ^
SyntaxError: invalid syntax

Any suggestion to fix this problem?

Upvotes: 5

Views: 11601

Answers (1)

Manoj Purohit
Manoj Purohit

Reputation: 3453

the >>> prompt indicates you are already running python interpreter.

You need to enter that command from the shell prompt.

Press Ctrl-D to exit Python to the ordinary shell prompt and try again.

P.S: I'm not related to anyway with python Reference : http://ubuntuforums.org/showthread.php?t=1558728

try this on ms-dos

cd\
cd C:\Users\YourUserName\Desktop
python filename.py

Upvotes: 6

Related Questions