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 want to start PowerShell (C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe) from windows 7 default command line (cmd) and go to the specific path.

I used the command:

start C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe

It'll work, and show the powershell window.

But, if I use:

start C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe Set-Location c:\

The black window will flash quickly.

How can I open powershell from cmd by the specific path? Thanks in advance.

share|improve this question
If you must use the full path to powershell.exe, better to use %windir%. – Jay Bazuzi Apr 28 '13 at 5:52
up vote 7 down vote accepted

Try this:

powershell -NoExit -Command "Set-Location c:\\"

If your path contains spaces, you can wrap it in single-quotes, like so:

powershell -NoExit -Command "Set-Location 'c:\\program files'"
share|improve this answer
How can I do when the path has space? for example, path1 = c:\Program files\vim, then > 'powershell -NoExit -Command "Set-Location ' + path1 + '"' only can open the powershell but cannot cd in the path1 – Marslo Apr 26 '13 at 5:59
Hi, I fix that. I using two strings, s1 = 'start C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe -NoExit -Command '; s2 = '"Select-Location ' + "'" + path1 + "'" + '"', and command = s1 + s2. then it works – Marslo Apr 26 '13 at 6:24
@Marslo: You can also use ' to wrap the path. Like: -Command "Set-Location 'C:\\Program Files'" – Oliver Salzburg Apr 26 '13 at 8:35
Yep! Thanks @Oliver Salzburg . :) I written this for gvim. I want to press F3(or other shortcuts) will show command line (Powershell) and cd in the current file path. – Marslo Apr 26 '13 at 12:57
@OliverSalzburg: Just found your answer while searching. Can you perhaps solve my closely related problem as well? – Karan Jun 17 '13 at 2:55

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.