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

Author Topic: "(" in a batch file!  (Read 5077 times)

0 Members and 1 Guest are viewing this topic.

Google

    Topic Starter


    Mentor

    Thanked: 2
    • Certifications: List
    • Experience: Experienced
    • OS: Windows 7
    "(" in a batch file!
    « on: August 08, 2006, 10:02:23 AM »
    What do brackets do in a batch file??
    « Last Edit: August 08, 2006, 10:04:45 AM by ffruit »

    Dusty



      Egghead

    • I could if she would, but she won't so I don't.
    • Thanked: 75
    • Experience: Beginner
    • OS: Windows XP
    Re: "(" in a batch file!
    « Reply #1 on: August 08, 2006, 09:21:15 PM »
    Have you lost your Google finger :-?

    Here is just one example (scroll down to the MDEL.BAT listing.)

    Good luck
    One good deed is worth more than a year of good intentions.

    GuruGary



      Adviser
      Re: "(" in a batch file!
      « Reply #2 on: August 08, 2006, 10:03:07 PM »
      The parenthesis '(' and ')' serve different functions depending on where they are used.  The most common example I can think of is to group commands or statements together.  Take the following example:
      Code: [Select]
      if ERRORLEVEL 1 (echo There was an error.
         echo The ERRORLEVEL is %errorlevel%.
         goto :EOF) else echo There was not an error.
      Typically, when a batch file processes an IF statement, and the IF statement is TRUE, then it will excute 1 command on the same line as the IF.  Since we have 3 statements surrounded in the parenthesis, it will group them together and execute all 3.
      Compare to:
      Code: [Select]
      if ERRORLEVEL 1 echo There was an error.
      echo The ERRORLEVEL is %errorlevel%.
      goto :EOF
      In the 2nd example, the last 2 lines of code get executed even when the IF statement is FALSE.

      Does that explain it?

      Google

        Topic Starter


        Mentor

        Thanked: 2
        • Certifications: List
        • Experience: Experienced
        • OS: Windows 7
        Re: "(" in a batch file!
        « Reply #3 on: August 09, 2006, 09:46:48 AM »
        yes thnx













































































































































































         ;D ;D ;D ;D ;D ;D ;D ;D