PC Review


Reply
Thread Tools Rate Thread

CMD waits app to return if commands passed as arguments ?

 
 
Vilius Mocknas
Guest
Posts: n/a
 
      14th Aug 2009
Hello,

By default cmd doesn't wait application to return if I type command
interactively:
>sol.exe

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


 
Reply With Quote
 
 
 
 
Pegasus [MVP]
Guest
Posts: n/a
 
      14th Aug 2009

"Vilius Mocknas" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello,
>
> By default cmd doesn't wait application to return if I type command
> interactively:
> >sol.exe

> 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


You do it like so:

start /b "Vilius' Program" sol.exe


 
Reply With Quote
 
\Rems
Guest
Posts: n/a
 
      17th Aug 2009

"Vilius Mockûnas" wrote:

> Hello,
>
> By default cmd doesn't wait application to return if I type command
> interactively:
> >sol.exe

> 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
>


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
 
Reply With Quote
 
Pegasus [MVP]
Guest
Posts: n/a
 
      17th Aug 2009

"\Rems" <(E-Mail Removed)> wrote in message
news:8758C0C4-A643-483C-88C3-(E-Mail Removed)...
> "Vilius Mocknas" wrote:
>
>> Hello,
>>
>> By default cmd doesn't wait application to return if I type command
>> interactively:
>> >sol.exe

>> 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
>>

>
> 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.


 
Reply With Quote
 
\Rems
Guest
Posts: n/a
 
      17th Aug 2009
"\Rems" wrote:

> "Vilius Mockûnas" wrote:
>
> > Hello,
> >
> > By default cmd doesn't wait application to return if I type command
> > interactively:
> > >sol.exe

> > 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
> >

>
> 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
 
Reply With Quote
 
Pegasus [MVP]
Guest
Posts: n/a
 
      17th Aug 2009

"\Rems" <(E-Mail Removed)> wrote in message
news:FF1F6B08-7048-4CD1-91A9-(E-Mail Removed)...
> "\Rems" wrote:
>
>> "Vilius Mocknas" wrote:
>>
>> > Hello,
>> >
>> > By default cmd doesn't wait application to return if I type command
>> > interactively:
>> > >sol.exe
>> > 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
>> >

>>
>> 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


You still have too many command processors. You can drop the whole lot - try
it!


 
Reply With Quote
 
\Rems
Guest
Posts: n/a
 
      17th Aug 2009
"Pegasus [MVP]" wrote:

>
> "\Rems" <(E-Mail Removed)> wrote in message
> news:8758C0C4-A643-483C-88C3-(E-Mail Removed)...
> > "Vilius Mockûnas" wrote:
> >
> >> Hello,
> >>
> >> By default cmd doesn't wait application to return if I type command
> >> interactively:
> >> >sol.exe
> >> 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
> >>

> >
> > 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.
>


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
 
Reply With Quote
 
\Rems
Guest
Posts: n/a
 
      17th Aug 2009


"Pegasus [MVP]" wrote:

>
> "\Rems" <(E-Mail Removed)> wrote in message
> news:FF1F6B08-7048-4CD1-91A9-(E-Mail Removed)...
> > "\Rems" wrote:
> >
> >> "Vilius Mockûnas" wrote:
> >>
> >> > Hello,
> >> >
> >> > By default cmd doesn't wait application to return if I type command
> >> > interactively:
> >> > >sol.exe
> >> > 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
> >> >
> >>
> >> 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

>
> 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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA: ByRef not returning changes to passed arguments Clif McIrvin Microsoft Excel Discussion 5 16th Mar 2009 06:26 PM
Passed Arguments to a UDF Bob Myers Microsoft Excel Worksheet Functions 9 23rd Nov 2008 09:03 AM
Argument List; Arguments Passed to the Procedure =?Utf-8?B?cnlndXk3Mjcy?= Microsoft Excel Programming 1 25th Jun 2007 08:48 PM
XP File Transfer Wizard waits, and waits, and waits...... =?Utf-8?B?Sm9obiBUaXB0b24=?= Windows XP New Users 3 18th Sep 2005 02:11 PM
Reading URL arguments passed via Hyperlink Hugh O Microsoft VB .NET 3 6th Sep 2005 10:23 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:47 PM.