1.

Solve : Wage batch file, help??

Answer»

echo off
cls
:hourly
Set hourly=
set /p hourly=Hourly wage:
Set hours=
set /p hours=Hours:
Set days=
set /p days=Days:
echo Weekly should be 4.5
Set weekly=
set /p weekly=weeks:
Set year=
set year= Months worked:
echo daily amount:
set /a %hourly%*%hours%
echo weekly amount:
set /a %hourly%*%hours%*%days%
echo monthly amount:
set /a %hourly%*%hours%*%days%*%weekly%
echo YEARLY amount:
set /a %hourly%*%hours%*%days%*%weekly%*%year%
pause

I'm being returned that the operators are missing. If anyone has documentation I can look at to fix this, would appreciate it.remove your echo off and run it again. You will spot your mistake easily Quote from: ghostdog74 on APRIL 15, 2010, 05:52:27 PM

remove your echo off and run it again. You will spot your mistake easily
AHEM, you didn't set a variable name with the set /a commands. Quote from: Helpmeh on April 15, 2010, 08:23:42 PM
AHEM, you didn't set a variable name with the set /a commands.
are you REPLYING to me or the OP ? Quote
If you use any of the logical or modulus operators, you will need to
enclose the expression string in quotes.  Any non-numeric strings in the
expression are treated as environment variable names whose values are
converted to numbers before using them.  If an environment variable name
is specified but is not defined in the current environment, then a value
of zero is used.  This allows you to do arithmetic with environment
variable values without having to type all those % signs to get their
values.  If SET /A is executed from the command line outside of a
command script, then it displays the final value of the expression.  The
assignment operator requires an environment variable name to the left of
the assignment operator.  Numeric values are decimal numbers...
 
Also, the % is used as an operator. So use of the % when using SET /A will generate an ERROR if there is no operand to go with it.

Or to put it simply, take out those % things unless you really want them.

Quote from: ghostdog74 on April 15, 2010, 09:05:09 PM
are you replying to me or the OP ?
OP. Quote from: ghostdog74 on April 15, 2010, 05:52:27 PM
remove your echo off and run it again. You will spot your mistake easily

was fixed here, sorry lost the url for the post. thank you everyone =]


Discussion

No Comment Found