Page 1 of 1

plz help !

Posted: 07 Oct 2011 06:49
by yoni779
Hi im kind of a newbie in batching i want to write a little program the will basicly will canculate Ohm's law here it is its not finished becuse it always goback to :resistent

@echo off
color b
:pstart
Set input
set /p input=Enter Resistent,Influx,Vault (R,I,V):
if %input%==R goto resistent
if %input%==I goto influx
if %input%==V goto vault

:resistent

set voltege
set /p voltege=Enter volts:
set current
set /p current=Enter current:
set /a Result=%voltege%/%current%
echo %Result%


:influx

set voltege
set /p voltege=Enter volts:
set resist
set /p resist=Enter resistnet:
set /a Result=%voltege%/%resistnet%
echo %Result%

thanks very much for helpers

Re: plz help !

Posted: 07 Oct 2011 15:44
by aGerman
untested:

Code: Select all

@echo off
color b
:pstart
Set "input="
set /p "input=Enter Resistent,Influx,Vault (R,I,V): "
if /i "%input%"=="R" goto resistent
if /i "%input%"=="I" goto influx
if /i "%input%"=="V" goto vault
echo Wrong input.
goto pstart

:resistent

set "voltege="
set /p "voltege=Enter volts: "
set "current="
set /p "current=Enter current: "
set /a Result=%voltege%/%current%
echo %Result%
pause
goto :eof


:influx

set "voltege="
set /p "voltege=Enter volts: "
set resist
set /p "resist=Enter resistnet: "
set /a Result=%voltege%/%resistnet%
echo %Result%
pause
goto :eof

:vault
REM Whatever you wanna do here.


Regards
aGerman