Solved

Problem with the arithmatic operations like addition.

Posted on 2003-11-19
4
663 Views
Last Modified: 2008-02-01
Hi,
I am trying to write a batch file which takes two parameters are input. The prog is given below.

for %j IN (1,1,%1) do GOTO=LOOP
:LOOP
IF %j == %1 GOTO END
set PRNNO = %2 + %j
echo %PRNNO%

:END

here the for loop has to go on till %1 number of times with increments of 1. Then each time it has to display the sum of the j value in the loop and the second parameter. Can some body help me in this regard.

-Kiran
0
Comment
Question by:bkirankumar
4 Comments
 
LVL 5

Accepted Solution

by:
brianadkins earned 125 total points
Comment Utility

Here's a first guess:

---------------8<------------------
set INPUT1=%1
set INPUT2=%2

for /l %%a in (1,1,%INPUT1%) do call :LOOP %%a

goto :END
:LOOP
set /a PRNNO=%INPUT2%+%1
echo %PRNNO%

:END
---------------8<------------------

-Brian
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

One of my most closely kept secrets is revealed in this discussion How to output text on the same line This question was recently posted in EE by Simon336697 (http://www.experts-exchange.com/Programming/Languages/Scripting/Shell/Batch/Q_2459…
Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now