Note that there are some explanatory texts on larger screens.

plurals
  1. PO"missing operator" error message while using the "set /a" command
    text
    copied!<p>Ok so ive been finishing off my batch program called "stringparsing.bat" and the last error im having trouble with is one that says "missing operator" when i use the following snippet:</p> <pre><code>set /p linecount= cls set foo=0 set linenumber=0 :lineset set /a linenumber=%linenumber% +1 set /p line1= %linenumber% echo %line1% &gt;&gt; %name%.txt set /a foo=%foo%+1 set /a line number=%linenumber%+1 IF %foo%==%linecount% goto MAIN123 goto lineset </code></pre> <p>More specificly, ive narrowed it down to : </p> <pre><code>set /a linenumber=%linenumber% +1 set /p line1= %linenumber% </code></pre> <p>Im pretty sure im mis-using the <strong>set /p</strong> command... what i am trying to do, is make a prompt that asks the user to input how many lines of text that they are going to insert into a text file. Then make a loop that asks the user to type some text which is then sent to the text file. But i wanted to to put the line number before the prompt so that it would look like this:</p> <p><img src="https://i.stack.imgur.com/e4y97.png" alt="alt text"></p> <p>So when the batch file asks for the first line, it says 1: , and when it asks for the second line, its says 2: , and so on. after each line prompt, i get the "missing operator" error message... Btw i need to use this scirpt to get it to work:</p> <p>set /p line1= %linenumber%+1</p> <p>But in order to use this command with the <strong>+1</strong> at the end, do i have to add the <strong>/a</strong> parameter as well as the <strong>/p</strong> parameter?</p> <p>Any ideas?</p>
 

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