CMD waits app to return if commands passed as arguments ?

  • Thread starter Thread starter Vilius Mockûnas
  • Start date Start date
V

Vilius Mockûnas

Hello,

By default cmd doesn't wait application to return if I type command
interactively:
But if I pass commands as cmd arguments - it will always wait app to return:
cmd /c sol.exe

I want cmd to return immediately but I must use commands as arguments using
/k or /c switches.
How do I solve this ?

thanks
Vilius
 
Vilius Mockûnas said:
Hello,

By default cmd doesn't wait application to return if I type command
interactively:
But if I pass commands as cmd arguments - it will always wait app to
return:

I want cmd to return immediately but I must use commands as arguments
using /k or /c switches.
How do I solve this ?

thanks
Vilius

You do it like so:

start /b "Vilius' Program" sol.exe
 
Vilius Mockûnas said:
Hello,

By default cmd doesn't wait application to return if I type command
interactively:
But if I pass commands as cmd arguments - it will always wait app to return:

I want cmd to return immediately but I must use commands as arguments using
/k or /c switches.
How do I solve this ?

thanks
Vilius

Running the command from within a batch? or by command line?

try the difference between,
cmd /c Start ""/b ping sol.exe
and,
cmd /c Start cmd /c sol.exe

In a batch you can skip the leading "cmd /c".

\Rems
 
\Rems said:
Running the command from within a batch? or by command line?

try the difference between,
cmd /c Start ""/b ping sol.exe
and,
cmd /c Start cmd /c sol.exe

In a batch you can skip the leading "cmd /c".

\Rems

In your command
cmd /c Start ""/b ping sol.exe
you can omit the extra command processor. It is sufficient to use
start /b "" sol.exe

In your command
cmd /c Start cmd /c sol.exe
you can omit both extra command processors. Again it is sufficient to use
start /b "" sol.exe

This command will work equally well at the Command Prompt or in batch files.
 
\Rems said:
Running the command from within a batch? or by command line?

try the difference between,
cmd /c Start ""/b ping sol.exe
and,
cmd /c Start cmd /c sol.exe

In a batch you can skip the leading "cmd /c".

\Rems

That should have been,

try the difference between,
cmd /c Start ""/b sol.exe
and,
cmd /c Start cmd /c sol.exe

In a batch you can skip the leading "cmd /c".
Are you running the command from within a batch? or from a prompt?

\Rems
 
\Rems said:
That should have been,

try the difference between,
cmd /c Start ""/b sol.exe
and,
cmd /c Start cmd /c sol.exe

In a batch you can skip the leading "cmd /c".
Are you running the command from within a batch? or from a prompt?

\Rems

You still have too many command processors. You can drop the whole lot - try
it!
 
Pegasus said:
In your command
cmd /c Start ""/b ping sol.exe
you can omit the extra command processor. It is sufficient to use
start /b "" sol.exe

In your command
cmd /c Start cmd /c sol.exe
you can omit both extra command processors. Again it is sufficient to use
start /b "" sol.exe

This command will work equally well at the Command Prompt or in batch files.

Yes I know that,
but thank you for clarifying.

Actually that was what I had in mind saying: "In a batch you can skip the
leading cmd /c ". And you're right, you also don't need the leading cmd /c
when typing it from a DOS-prompt, obviously.
The OP mensioned: "type command interactively >sol.exe"

However, note that the OP did also stated: "but I must use commands as
arguments using /k or /c switches" - So I wonder why that is... !
- The leading "cmd /c" IS needed when executing from Start | Run or using a
vbscript to run it.
- It could also be that the OP needs the supplement box (sample 2) for some
purpose.
Anyway, that is why my two samples look as they do, in addition to the
correctly dos command you posted a few days ago.

Thanks.
\Rems
 
Pegasus said:
You still have too many command processors. You can drop the whole lot - try
it!

I know,
however it was *intentionally* added --- see my other reply for clarification.

thanks

\Rems
 
Back
Top