Helping people with computers... one answer at a time.
Start-Run, or the Run item on Windows Start menu is a way to run any program on your machine. Some will work as expected, but Start-Run of others just produces a quick flash. We'll look at why, and what to do instead.
When I try to use "Start" and then "Run" to run a command the DOS screen flashes momentarily then vanishes. Am I overlooking something obvious?
Not really. It's only obvious if you've been using PCs since before there was Windows, and before there was a GUI.
Start-Run is incredibly useful, but it's not appropriate for everything. The good news is that there's a simple trick that covers all.
The "problem" here is that there are two types of programs.
Programs with a Graphical User Interface or "GUI", are probably the one's you're most familiar with. Your mail program, your web browser, text editors, word processors, these all display in Windows with various graphical user interface components... fancy icons, colorful images and controls, and just about anything that might be drawn on the screen.
Before there was a GUI, there was what we now call a "Character Mode User Interface" (no fancy acronym for this one). In character mode you interact with the computer via a screen that has (usually) 25 lines of 80 characters each. That's it. Each "character" can be a letter or number or a number of special characters, but character mode explicitly does not support images or graphics.
MS-DOS was built around this command-line character mode user interface.
What's this "command line"? Well, if you have no graphics, you have no menus or icons to click on to run programs. Instead, you typed in certain commands or the name of the program you wanted to run, pressed Return, and MS-DOS would locate the program and run it. You want to start the old character mode version of Microsoft Word? If you had it on you machine, you'd type "Word" followed by Enter, and there it'd be.
Windows supports both GUI and character mode applications. When you run a program, either by double clicking on an icon, selecting a menu item, or using Start-Run, Windows takes a look at the program, determines what kind it is, and "does the right thing". For a GUI application, that means run it directly in Windows. For a character mode application, though, Windows first starts up a character mode environment for the application to run in and then runs the program in that environment. When the program exits, Windows then tears down that character mode environment.
That environment, by the way, is the "DOS screen" you refer to, more correctly now called a Windows Command Prompt, or Virtual DOS Machine. The window you're seeing flash up is a Command Prompt window. The command you're running apparently exits quickly, and the window is immediately closed.
Let's use an example.
Click on Start, followed by Run, and type in "SFC" (the System File Checker), and press OK. You should see a window flash, and not much else.
Now, click on Start, followed by Run, and type "CMD". Press OK, and you should see a window much like this:
This is the Windows Command Prompt. It's a character mode interface that you can work in.
Now, in the command prompt, type "SFC" followed by Enter, and you should see something like this:
Now you can see that SFC has run, printed a message, and exited. When run from Start-Run, this message is lost as the Command Prompt window is automatically opened and quickly closed when SFC finishes. By starting your own Command Prompt, you control when the Window closes.
In this case, "SFC" requires a parameter of some sort before it will do its work. Typically the correct command to type in is "SFC /SCANNOW". If you do that, the command prompt will return immediately, but SFC will continue running in a new window. SFC is an example of a mixed-mode application - it outputs its initial error messages in character mode, but then switches to graphical mode to do its work.
The most common cause of a quick flash after typing a command into Start-Run is that the program is reporting an error of some sort. The simple solution is to run "CMD", and then type the original command into the resulting command prompt windows. You can type the command "Exit" to exit the command prompt window, or you can just click on the close box in its upper right corner.
A full discussion of the Command Prompt is outside the scope of an article such as this. Indeed, to do so would be to re-document something on the order of MS-DOS, plus the many features and commands that have been added to the command prompt since then.
Comments on this entry are closed.
If you have a question, start by using the search box up at the top of the page - there's a very good chance that your question has already been answered on Ask Leo!.
If you don't find your answer, head out to http://askleo.com/ask to ask your question.