Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Although Martin's answer describe how to <em>create</em> the unique variables, he didn't explained how to <em>read</em> them. When you are talking about "saves each answer as a unique variable" the involved concept here is <em>ARRAY</em>. You need to use Delayed Expansion in order to get the values of the unique variables ("array elements"); for further details, type <code>set /?</code> and look for "delayed expansion". You may read a detailed description about array management in Batch files at this post: <a href="https://stackoverflow.com/questions/10166386/arrays-linked-lists-and-other-data-structures-in-cmd-exe-batch-script/10167990#10167990">Arrays, linked lists and other data structures in cmd.exe (batch) script</a></p> <pre><code>@echo off setlocal EnableDelayedExpansion set /p howmany=How many files do you want to add? for /L %%i in (1,1,%howmany%) do ( set /p inputfilename[%%i]=what is the name of the file you want to add? ) rem Process array elements (just show them in this case) for /L %%i in (1,1,%howmany%) do ( echo %%i- !inputfilename[%%i]! ) </code></pre> <p>The example below may help you in understanding array management in an easier way:</p> <pre><code>@echo off setlocal EnableDelayedExpansion rem Create an array of ordinal terms set i=0 for %%a in (first second third fourth fifth sixth) do ( set /A i+=1 set term[!i!]=%%a ) rem Previous FOR is equivalent to: set term[1]=first, set term[2]=second, ... set /p howmany=How many files do you want to add? for /L %%i in (1,1,%howmany%) do ( set /p inputfilename[%%i]=what is the name of the !term[%%i]! file you want to add? ) rem Process array elements (just show them in this case) for /L %%i in (1,1,%howmany%) do ( echo The !term[%%i]! file is !inputfilename[%%i]! ) </code></pre>
    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. 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