Windows – Batch file for starting powershell in a specific directory

batchpowershellwindows

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.

Best Answer

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'"
Related Question