Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Scripting > CMD waits app to return if commands passed as arguments ?

Reply
Thread Tools Display Modes

CMD waits app to return if commands passed as arguments ?

 
 
Vilius Mockûnas
Guest
Posts: n/a

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

 
      08-14-2009

"Vilius Mockûnas" <> wrote in message
news:...
> 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

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

 
      08-17-2009

"\Rems" <> wrote in message
news:8758C0C4-A643-483C-88C3-...
> "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.


 
Reply With Quote
 
\Rems
Guest
Posts: n/a

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

 
      08-17-2009

"\Rems" <> wrote in message
news:FF1F6B08-7048-4CD1-91A9-...
> "\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!


 
Reply With Quote
 
\Rems
Guest
Posts: n/a

 
      08-17-2009
"Pegasus [MVP]" wrote:

>
> "\Rems" <> wrote in message
> news:8758C0C4-A643-483C-88C3-...
> > "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

 
      08-17-2009


"Pegasus [MVP]" wrote:

>
> "\Rems" <> wrote in message
> news:FF1F6B08-7048-4CD1-91A9-...
> > "\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
Display Modes

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
Explorer waits and waits agh Internet Explorer 1 12-09-2007 07:54 PM
how do we read the return data of atatpi commands shoeb Windows Vista Drivers 0 01-24-2007 01:13 PM
[MSH] Should these two commands return the same properties? Andrew Watt [MVP] Scripting 2 04-04-2006 02:55 PM
MCE 2004 SP2 waits at Welcome screen Nigel Andrews Windows Media Center 0 12-04-2004 11:01 PM
2 Kewaitforsingleobject which waits for same event. Lee Haejin Windows Vista Drivers 2 01-07-2004 10:45 AM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59