Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>My suggestion is to use <code>CALL</code> command. An example from <a href="http://www.robvanderwoude.com/call.php" rel="nofollow">Batch Files</a>:</p> <p>Batch1.bat listing:</p> <pre><code>REM Batch1.bat SET ABC=1 CALL BATCH2.BAT %ABC% ECHO ABC = %ABC% BATCH2.BAT %ABC% ECHO ABC = %ABC% </code></pre> <p>where Batch2.bat listing is:</p> <pre><code>REM Batch2.bat SET ABC=%ABC%%1 </code></pre> <p><hr /> <strong>EDIT:</strong> based on feedback from @Andriy M, here is an improved version for the two batches:</p> <p>Batch 1:</p> <pre><code>@ECHO OFF REM Batch1.bat SET ABC=1 CALL batch2.bat %ABC% ECHO 1. ABC = %ABC% CALL batch2.bat %ABC% REM test this line with CALL and without ECHO 2. ABC = %ABC% </code></pre> <p>Batch 2:</p> <pre><code>@ECHO OFF REM Batch2.bat SET tmout=5 echo sleeping %tmout% seconds... REM this introduces a timeout by using a nonexistent ip address PING 1.2.1.2 -n 1 -w %tmout%000 &gt; NUL echo done sleeping SET ABC=%ABC%%1 </code></pre> <p>See the line in batch1 where I wrote the comment <em>test this line with CALL and without</em>. Run that batch twice, with that line having <code>CALL</code> and without <code>CALL</code>.</p> <p>The output from console <em>without</em> <code>CALL</code>:</p> <pre><code>C:\temp&gt;batch1.bat sleeping 5 seconds... done sleeping 1. ABC = 11 sleeping 5 seconds... done sleeping </code></pre> <p>And now the output from console <em>with</em> <code>CALL</code>:</p> <pre><code>C:\temp&gt;batch1.bat sleeping 5 seconds... done sleeping 1. ABC = 11 sleeping 5 seconds... done sleeping 2. ABC = 1111 </code></pre> <p>Please note the difference: we get the 2nd echo, q.e.d.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload