plz help !

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
yoni779
Posts: 1
Joined: 07 Oct 2011 06:39

plz help !

#1 Post by yoni779 » 07 Oct 2011 06:49

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

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: plz help !

#2 Post by aGerman » 07 Oct 2011 15:44

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

Post Reply