Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

cmd.exe /c not automatically closing

18 views
Skip to first unread message

Craig Ferraguti

unread,
Aug 7, 2003, 3:47:04 PM8/7/03
to
I have a VB program that uses the cmd.exe program on a
Windows 2000 Advanced Server computer. When SP3 was
installed the /c option would automatically close after
the program that cmd.exe spawned was completed. After
installing SP4 the cmd.exe no longer auto-closes. I have
also tried this from the run dialog. Again, the /c option
will work on the SP3 box but not the SP4. Is there
anything I can do to fix this? Or is Microsoft currently
working on the problem?

Thanks in advance,
Craig

Craig Ferraguti

unread,
Aug 7, 2003, 4:15:07 PM8/7/03
to
I forgot to mention I am running the rsh command from the
cmd.exe. Here is the full call to the cmd prompt I am
using.

cmd.exe /c rsh server -l user /dir/progname param1 param2
> c:\temp\text.txt

Thanks again,
Craig

Walter Briscoe

unread,
Aug 8, 2003, 2:00:55 AM8/8/03
to
In message <029f01c35d1c$ad10c250$a401...@phx.gbl> of Thu, 7 Aug 2003
12:47:04 in microsoft.public.win2000.cmdprompt.admin, Craig Ferraguti
<cferr...@hotmail.com> writes
In Windows 2000 Professional SP3, I have a file C:\winnt\_default.pif.
If I open its Properties dialog (by right-clicking it or otherwise), the
Program tab has a "Close on exit" checkbox. That may be the relevant
control. (It had no immediate effect when I inverted it and I do not
want to do a reboot to confirm the guess at the moment.)
Why did you upgrade?
Could you use CreateProcess to start rsh rather than cmd?
--
Walter Briscoe

Herb Martin

unread,
Aug 8, 2003, 4:43:12 AM8/8/03
to
SP4 -- these commands:

C:\>start /separate cmd /c dir

C:\>start /separate cmd /k dir

The first returns, the second stays open as documented.

Best GUESS is that it is something to do with the rsh,
probably not directly in the cmd behavior (although it
could be.)


Craig Ferraguti

unread,
Aug 8, 2003, 2:51:46 PM8/8/03
to
>Could you use CreateProcess to start rsh rather than cmd?

I'm actually using CreateProcess to spawn the cmd.exe that
I am passing the rsh command to. I had to call the
cmd.exe in order to redirect the results of the rsh to a
file. For some reason it wouldn't work without the
cmd.exe.

Today I figured out another way to do this. Instead of
calling the rsh command through the CreateProcess function
and waiting for it to terminate (which it never did), I
created a temporary batch file with the rsh command that
redirects the output to a file. Then I opened the batch
command with the CreateProcess function and waited for it
to return. Then opened the results file and grabbed the
data. I'm not sure why the same command works in a batch
file but not as a parameter to the create process function.

>Why did you upgrade?
For the security updates mostly.

Thanks for your help,
Craig

0 new messages