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

Author Topic: Batch to Run 3 Programs  (Read 7883 times)

0 Members and 1 Guest are viewing this topic.

EchoLdrWolf316

    Topic Starter


    Intermediate

  • Don't worry, Javascript is just Flash on speeeeed.
    Batch to Run 3 Programs
    « on: August 21, 2008, 02:14:46 PM »
    How would i word the code for a batch file to run the following programs:

    "C:\Program Files\Mioplanet Battery Meter\Mioplanet Battery Meter.exe"

    "C:\Program Files\Pixoria\Konfabulator\YahooWidgets.exe"

    "C:\Program Files\Stardock\ObjectDock\ObjectDock.exe"

    ?

    EchoLdrWolf316

      Topic Starter


      Intermediate

    • Don't worry, Javascript is just Flash on speeeeed.
      Re: Batch to Run 3 Programs
      « Reply #1 on: August 21, 2008, 03:03:02 PM »
      And how would I make a yes/no question in it? I am puttin a shortcut to  this batch in my startup folder (Vista Home Premium) and I want it to ask "Do You Want To Run Mac Look-Alike Programs?"  So, yes = run programs, no = exit, don't run anything. I just want that command so depending on what I am planning on doing when i turn on the computer, I cant start those programs for visual "ambience," or not run them for easier navigation.

      fireballs



        Apprentice

      • Code:Terminal
      • Thanked: 3
        Re: Batch to Run 3 Programs
        « Reply #2 on: August 21, 2008, 03:12:03 PM »
        how about:

        Code: [Select]
        @echo off
        Choice /M "Do You Want To Run Mac Look-Alike Programs?"
        if errorlevel 1 goto yes
        if errorlevel 2 goto no

        :yes
        "C:\Program Files\Mioplanet Battery Meter\Mioplanet Battery Meter.exe"
        "C:\Program Files\Pixoria\Konfabulator\YahooWidgets.exe"
        "C:\Program Files\Stardock\ObjectDock\ObjectDock.exe"
        exit

        :no
        exit

        post back whether it works

        FB
        Next time google it.

        EchoLdrWolf316

          Topic Starter


          Intermediate

        • Don't worry, Javascript is just Flash on speeeeed.
          Re: Batch to Run 3 Programs
          « Reply #3 on: August 21, 2008, 03:32:55 PM »
          it runs the battery meter.exe fine, but seems to hang up on the other two  :-\ and even if i answer "N" for no, it still try to run them  ???

          Im going to a baseball game, i'll be back around 10:30 EST / 3:30 GMT.

          Dias de verano

          • Guest
          Re: Batch to Run 3 Programs
          « Reply #4 on: August 21, 2008, 03:47:02 PM »
          errorlevels should be in DESCENDING order

          if errorlevel 2 goto no
          if errorlevel 1 goto yes

          EchoLdrWolf316

            Topic Starter


            Intermediate

          • Don't worry, Javascript is just Flash on speeeeed.
            Re: Batch to Run 3 Programs
            « Reply #5 on: August 21, 2008, 08:27:25 PM »
            i'm back, the no command works now...... But it's still hanging up on the second .exe, (i tried re-ordering them, it didn't fix anything)

            i can manually load each of those programs through DOS, so the addresses are correct, ..ideas?

            Carbon Dudeoxide

            • Global Moderator

            • Mastermind
            • Thanked: 169
              • Yes
              • Yes
              • Yes
            • Certifications: List
            • Experience: Guru
            • OS: Mac OS
            Re: Batch to Run 3 Programs
            « Reply #6 on: August 21, 2008, 08:30:13 PM »
            Code: [Select]
            @echo off
            Choice /M "Do You Want To Run Mac Look-Alike Programs?"
            if errorlevel 1 goto yes
            if errorlevel 2 goto no

            :yes
            start "" "C:\Program Files\Mioplanet Battery Meter\Mioplanet Battery Meter.exe"
            start "" "C:\Program Files\Pixoria\Konfabulator\YahooWidgets.exe"
            start "" "C:\Program Files\Stardock\ObjectDock\ObjectDock.exe"
            exit

            :no
            exit

            Try that.

            EchoLdrWolf316

              Topic Starter


              Intermediate

            • Don't worry, Javascript is just Flash on speeeeed.
              Re: Batch to Run 3 Programs
              « Reply #7 on: August 21, 2008, 08:31:54 PM »
              Code: [Select]
              @echo off
              Choice /M "Do You Want To Run Mac Look-Alike Programs?"
              if errorlevel 1 goto yes
              if errorlevel 2 goto no

              :yes
              start "" "C:\Program Files\Mioplanet Battery Meter\Mioplanet Battery Meter.exe"
              start "" "C:\Program Files\Pixoria\Konfabulator\YahooWidgets.exe"
              start "" "C:\Program Files\Stardock\ObjectDock\ObjectDock.exe"
              exit

              :no
              exit

              Try that.

              That works perfectly!  :) Thank-you

              EchoLdrWolf316

                Topic Starter


                Intermediate

              • Don't worry, Javascript is just Flash on speeeeed.
                Re: Batch to Run 3 Programs
                « Reply #8 on: August 21, 2008, 08:34:04 PM »
                Now, can you just explain what the
                Code: [Select]
                start "" command does? i understand that it tells the batch to load each program at the following address, but what would the
                Code: [Select]
                "" be used for? a boolean operator?

                EDIT: Okay, I found that will title the opened window whatever is typed in those quotes.

                EchoLdrWolf316

                  Topic Starter


                  Intermediate

                • Don't worry, Javascript is just Flash on speeeeed.
                  Re: Batch to Run 3 Programs
                  « Reply #9 on: August 22, 2008, 07:15:26 AM »
                   ??? The No command isn't working, it's starting up the programs.  :-\

                  Carbon Dudeoxide

                  • Global Moderator

                  • Mastermind
                  • Thanked: 169
                    • Yes
                    • Yes
                    • Yes
                  • Certifications: List
                  • Experience: Guru
                  • OS: Mac OS
                  Re: Batch to Run 3 Programs
                  « Reply #10 on: August 22, 2008, 07:17:44 AM »
                  I don't know much about this, but try swapping them around.

                  Code: [Select]
                  @echo off
                  Choice /M "Do You Want To Run Mac Look-Alike Programs?"
                  if errorlevel 1 goto yes
                  if errorlevel 2 goto no

                  :no
                  exit

                  :yes
                  start "" "C:\Program Files\Mioplanet Battery Meter\Mioplanet Battery Meter.exe"
                  start "" "C:\Program Files\Pixoria\Konfabulator\YahooWidgets.exe"
                  start "" "C:\Program Files\Stardock\ObjectDock\ObjectDock.exe"
                  exit

                  EchoLdrWolf316

                    Topic Starter


                    Intermediate

                  • Don't worry, Javascript is just Flash on speeeeed.
                    Re: Batch to Run 3 Programs
                    « Reply #11 on: August 22, 2008, 07:37:55 AM »
                    errorlevels should be in DESCENDING order

                    if errorlevel 2 goto no
                    if errorlevel 1 goto yes


                    I found the problem  ::)

                    Dias de verano

                    • Guest
                    Re: Batch to Run 3 Programs
                    « Reply #12 on: August 22, 2008, 10:09:50 AM »
                    errorlevels should be in DESCENDING order

                    if errorlevel 2 goto no
                    if errorlevel 1 goto yes


                    I found the problem  ::)


                    The trouble is that 

                    if errorlevel N

                    means "if errorlevel is equal to, or greater than N"

                    so if the errorlevel is equal to 2, then the test "if errorlevel 1" is satisfied. That is why we test for the highest errorlevel expected, first, and then work our way down.

                    HOWEVER

                    Windows 2000 introduced an alternative, a variable called %errorlevel% and you can do

                    If %errorlevel% EQU X
                    If %errorlevel% EQU Y
                    If %errorlevel% EQU Z

                    in any order you like.

                    Just don't mix them up.


                    EchoLdrWolf316

                      Topic Starter


                      Intermediate

                    • Don't worry, Javascript is just Flash on speeeeed.
                      Re: Batch to Run 3 Programs
                      « Reply #13 on: August 22, 2008, 10:18:00 AM »
                      errorlevels should be in DESCENDING order

                      if errorlevel 2 goto no
                      if errorlevel 1 goto yes


                      I found the problem  ::)


                      The trouble is that 

                      if errorlevel N

                      means "if errorlevel is equal to, or greater than N"

                      so if the errorlevel is equal to 2, then the test "if errorlevel 1" is satisfied. That is why we test for the highest errorlevel expected, first, and then work our way down.

                      HOWEVER

                      Windows 2000 introduced an alternative, a variable called %errorlevel% and you can do

                      If %errorlevel% EQU X
                      If %errorlevel% EQU Y
                      If %errorlevel% EQU Z

                      in any order you like.

                      Just don't mix them up.



                      So the file could read something like:
                      Code: [Select]
                      @echo off
                      Choice /M "Do You Want To Run Mac Look-Alike Programs?"

                      If %errorlevel% EQU N goto no
                      If %errorlevel% EQU Y goto yes


                      :yes
                      start "" "C:\Program Files\Mioplanet Battery Meter\Mioplanet Battery Meter.exe"
                      start "" "C:\Program Files\Pixoria\Konfabulator\YahooWidgets.exe"
                      start "" "C:\Program Files\Stardock\ObjectDock\ObjectDock.exe"
                      exit

                      :no
                      exit

                      like that, because that loads them on Y and N  :-\

                      Dias de verano

                      • Guest
                      Re: Batch to Run 3 Programs
                      « Reply #14 on: August 22, 2008, 10:23:54 AM »
                      You  misunderstand. I used N, X, Y, Z as examples of NUMBERS. Like in algebra.