Keep command prompt open?

G

Guest

Is there a tweak that keeps a command prompt open after executing a program from Windows Explorer? I have several programs that I run from Explorer. They open up a command prompt window, but the window closes out before I am able to read the results of the program

It is getting tiring to keep opening a command prompt window, type in the command to run the program and then view the results. I'm hoping that there is a registry tweak that will keep a command prompt window open after simply clicking on the program icon in Explorer

Matt
 
D

Donald McDaniel

Matt said:
Is there a tweak that keeps a command prompt open after executing a
program from Windows Explorer? I have several programs that I run
from Explorer. They open up a command prompt window, but the window
closes out before I am able to read the results of the program.

It is getting tiring to keep opening a command prompt window, type in
the command to run the program and then view the results. I'm hoping
that there is a registry tweak that will keep a command prompt window
open after simply clicking on the program icon in Explorer.

Matt

1) Right-click on the Console program icon, and choose "Properties".
2) Click on the "Program" tab
3) Clear the check box which is labeled "Close on exit"
"Ok" out.

**** NOTE ****
This will not work for Windows program icons, since a Windows program icon
does not have the needed property sheet.


--
Donald L McDaniel
Post all replies to the Newsgroup,
so that all may be informed.
Remove the obvious to reply by email.
+++++++++++++++++++++++++++++++++++++
 
C

Carrie Garth

Matt said:
wrote in message Is there a tweak that keeps a command prompt open after executing a program from
Windows Explorer? I have several programs that I run from Explorer. They open up
a command prompt window, but the window closes out before I am able to read the
results of the program. <SNIP>

In short, add the cmd /k parameter which tells cmd.exe to carry out the command
specified and continue.

For example, if the program in question is a built-in command-line program such as
Driver Query (driverquery.exe) you would do this:

- Create a shortcut to driverquery.exe
- Right-click the shortcut and click Properties
- Change the target from:

C:\WINDOWS\system32\driverquery.exe

to

cmd.exe /k driverquery.exe

Note 1: Since both programs (cmd.exe and driverquery.exe) reside in a path
(C:\WINDOWS\system32\) defined by an environment variable it is not necessary to use
the complete path to the programs.

Of course, if you are working with a program that does not reside in a path defined
by environment variables you would need to supply the complete path.

An easy way to display the current environment variables is to click Start, click
Run, type the following command and click OK:

cmd /k echo %Path%

For more information about managing environment variables see the following Microsoft
Knowledge Base article:

KB310519 - HOW TO: Manage Environment Variables in Windows XP
http://support.microsoft.com/default.aspx?Product=winxp&scid=kb;en-us;310519

Note 2: If you add the appropriate parameters you can redirect the command output
stream to a text file. For example, say you keep system configuration information
and status reports in the a folder named C:\Computer\Config. And say that you want
to create and save an Analysis Report generated by defrag.exe of your C: partition.
What you would do is create a shortcut in your C:\Computer\Config folder with the
following properties. Then, all you have to do is double-click the shortcut to
generate the report and close the command prompt.

Target: %windir%\System32\cmd.exe /k defrag c: -a -v > defrag.txt & Exit
Start in: C:\MyComp\Config

For a "Command shell overview" and information about "command redirection operators"
search the Help and Support Center for the phrases words in double-quotes.
 
J

janise

Matt described exactly what is the problem for me. I'm encountering this
time to time.

Thank you for the answers, however it is not very much easier and
faster to do this than simply open the command prompt and call the
program from there - if the program is run only for a few times (not
frequently).

Isn't it somehow possible to configure this command prompt to stay open
after the program executs by default? Without the "K" switch? So that
when I run any program which opens a command prompt window, that window
will stay open?

Thanks!
 
E

Erasmus

There is no easier way to do it. In the registry, all files that are
opened in a cmd prompt are actually opened via the query.dll file,
which determines what type of file you are trying to execute, and how
to handle it. You would have to either rewrite query.dll, which
backwards engineering it would be illegal, or you would have to change
the persistent handler in the registry for all files you expect to have
open in cmd, and create a new entry that specifies using "cmd.exe /k
%1" as the default data, though I do not know exactly how you would go
about making these changes in the registry, and I would recommend that
you simply either get used to typing cmd /k in the run window, or you
create shortcuts for the items you most frequently expect to run in
cmd, and do as was suggested above in changing the target of the
shortcut.

Good luck!


--
Erasmus

Hacker:
1.n. Anyone who, immediately after installing a program, clicks on
Tools > Options.
2.n. An individual that endeavors to push hardware and software to do
what it was never intended to do, and succeeds.
Cracker:
1.n. An idiot hacker with delusions of grandeur that 'hacks' for
malicious purposes.
 
B

Black Baptist

janise rambled on in microsoft.public.windowsxp.customize:
Matt described exactly what is the problem for me. I'm encountering this
time to time.

Thank you for the answers, however it is not very much easier and
faster to do this than simply open the command prompt and call the
program from there - if the program is run only for a few times (not
frequently).

Isn't it somehow possible to configure this command prompt to stay open
after the program executs by default? Without the "K" switch? So that
when I run any program which opens a command prompt window, that window
will stay open?

Thanks!

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-
us/cmd.mspx?mfr=true
 
T

Trevor L.

Black said:
janise rambled on in microsoft.public.windowsxp.customize:

I am not sure of the context, but to run a command from the command window
and keep it open, just add the extra command "pause" (without the quotes)
after the command you want executed. You can scroll up and down, but
pressing any key closes the window
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top