Windows – Why does the command window always disappear right away on Windows 7

command linerubywindows 7

I hope I am missing something blindingly obvious here, but I can't get things I run from the command window to stay open.

That is,
1. I open a new command prompt (windows key + r) + "cmd"
2. I try any of the possibilities in my question below in the resulting window
3. A new ruby window opens and then closes and I can't see any of the output

For example, I am trying to write some ruby code and run rspec. However, I have tried

  • rspec
  • cmd /k rspec
  • start /B rspec
  • from run menu: cmd rspec (rspec doesn't even run)

Each time the window closes as soon as it finishes executing. It would be great if it just executed in the same window I had open and stayed open.

Is there some kind of setting I am missing here?

As a workaround I can run irb and then use the back-tick method like so

`rspec`

And that runs well – the output persists onscreen and I can keep working. But this is really painful. It was much easier in Windows XP and I find it difficult to believe that Windows 7 can't support something similar.

Best Answer

Type cmd in the Start Menu search box, right-click cmd.exe, click Run as administrator, select Yes in the UAC dialog and enter your admin password if prompted.

This opens an elevated command prompt. Now run your Ruby commands as usual.

Related Question