Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am learning to program in python through the book "Learn python the hard way". Therefore I use powershell to run my programs. Since I had to manually change the directory every-time I started powershell , I wrote a batch file to automate it.

The command I wrote is :

powershell.exe -noexit -command "'cd c:\self\pooja\"edu n career"\programs\python'"

The problem is that it runs but opens the directory of "programs" only. Why is it not changing to python directory?

Finally , I did it by setting the "Start in" field in the shortcut property of powershell but I want to know why the batch file is not working as expected.

share|improve this question
up vote 2 down vote accepted

Close Nate, but that doesn't work when I run it on a "New Folder". Had to move the CD outside the single quotes to make it work.

powershell.exe -noexit -command "cd 'c:\New folder'"
powershell.exe -noexit -command "cd 'c:\self\pooja\edu n career\programs\python'"
share|improve this answer

I'm not quite sure what your directory folder looks like, but assuming that edu n career is one directory, you shouldn't need to escape that with its own set of double quotes, you should be able to change the code to

powershell.exe -noexit -command "'cd c:\self\pooja\edu n career\programs\python'"

If you look at the command in a text editor with syntax highlighting, you can see that the edu n career is actually not part of the command.


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.