Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Wage batch file, help?  (Read 3446 times)

0 Members and 1 Guest are viewing this topic.

Phuhrenzix

    Topic Starter


    Rookie

    • Certifications: List
    • Experience: Expert
    • OS: Other
    Wage batch file, help?
    « on: April 15, 2010, 05:42:27 PM »
    @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.

    ghostdog74



      Specialist

      Thanked: 27
      Re: Wage batch file, help?
      « Reply #1 on: April 15, 2010, 05:52:27 PM »
      remove your @echo off and run it again. You will spot your mistake easily

      Helpmeh



        Guru

      • Roar.
      • Thanked: 123
        • Yes
        • Yes
      • Computer: Specs
      • Experience: Familiar
      • OS: Windows 8
      Re: Wage batch file, help?
      « Reply #2 on: April 15, 2010, 08:23:42 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.
      Where's MagicSpeed?
      Quote from: 'matt'
      He's playing a game called IRL. Great graphics, *censored* gameplay.

      ghostdog74



        Specialist

        Thanked: 27
        Re: Wage batch file, help?
        « Reply #3 on: April 15, 2010, 09:05:09 PM »
        AHEM, you didn't set a variable name with the set /a commands.
        are you replying to me or the OP ?

        Geek-9pm


          Mastermind
        • Geek After Dark
        • Thanked: 1026
          • Gekk9pm bnlog
        • Certifications: List
        • Computer: Specs
        • Experience: Expert
        • OS: Windows 10
        Re: Wage batch file, help?
        « Reply #4 on: April 15, 2010, 09:22:25 PM »
        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.


        Helpmeh



          Guru

        • Roar.
        • Thanked: 123
          • Yes
          • Yes
        • Computer: Specs
        • Experience: Familiar
        • OS: Windows 8
        Re: Wage batch file, help?
        « Reply #5 on: April 16, 2010, 03:29:51 PM »
        are you replying to me or the OP ?
        OP.
        Where's MagicSpeed?
        Quote from: 'matt'
        He's playing a game called IRL. Great graphics, *censored* gameplay.

        Phuhrenzix

          Topic Starter


          Rookie

          • Certifications: List
          • Experience: Expert
          • OS: Other
          Re: Wage batch file, help?
          « Reply #6 on: July 10, 2010, 03:44:55 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 =]