Page 1 of 1

call commands using in a single line

Posted: 06 Sep 2022 00:35
by KSKwin123
how to call 2 subroutine in a same command line in an batch file

eg
call :subroutine1 && :subroutine2

Re: call commands using in a single line

Posted: 06 Sep 2022 01:57
by miskox
Maybe

Code: Select all

call :sub1&call :sub2
?

or maybe

Code: Select all

(call :sub1)&(call :sub2)
Saso

Re: call commands using in a single line

Posted: 06 Sep 2022 02:07
by aGerman
Yeah, the && is like a conditional command concatenation. Only if :subroutine1 returns errorlevel 0 :subroutine2 will be called. So a single & might be the better choice.

However, having both call commands in one line does not mean that the subroutines are running asynchronously (in parallel). They are still executed one after the other.

Steffen

Re: call commands using in a single line

Posted: 06 Sep 2022 09:10
by KSKwin123
HI,

Single & works well. Thanks for your help.