Loading ...
Sorry, an error occurred while loading the content.

Re: [BATCH WORLD] process the list in reverse order in batch file

Expand Messages
  • giskier
    You can always reverse the original string, and then process the reversed string front to back for what you need to accomplish. Sample code which will reverse
    Message 1 of 11 , Aug 8, 2009
    • 0 Attachment
      You can always reverse the original string, and then process the reversed
      string front to back for what you need to accomplish. Sample code which
      will reverse a comma separated string is:

      setlocal ENABLEDELAYEDEXPANSION
      set foo=one,two,three,four
      set revFoo=
      set commaAdder=

      :reverseLoop
      for /F "tokens=1,* delims=," %%p in ("!foo!") do (set
      revFoo=%%p!commaAdder!!revFoo!&set foo=%%q&set commaAdder=,)
      if not "!foo!" == "" goto :reverseLoop

      echo foo is !foo!
      echo revFoo is !revFoo!

      In order to better debug your batch code, I recommend using Running Steps.
      The batch debugger from Stepping Software (http://www.steppingsoftware.com).
      It has a code analyzer which provides you with errors and warnings even
      before you start executing, plus you can step through your code, watch
      variables, etc.

      Good Luck

      GISkier

      --
      View this message in context: http://www.nabble.com/process-the-list-in-reverse-order-in-batch-file-tp24846264p24877981.html
      Sent from the Batch World mailing list archive at Nabble.com.
    • foxidrive
      Be careful with the URLs below - I don t think nabble.com it affiliated with batchworld at all. They could be links with malware exploits. On Sat, 8 Aug 2009
      Message 2 of 11 , Aug 8, 2009
      • 0 Attachment
        Be careful with the URLs below - I don't think nabble.com it affiliated
        with batchworld at all. They could be links with malware exploits.


        On Sat, 8 Aug 2009 08:34:56 -0700 (PDT), giskier
        <gonzaloi@...> wrote:

        >
        >In order to better debug your batch code, I recommend using Running Steps.
        >The batch debugger from Stepping Software (http://www.steppingsoftware0.com).
        >It has a code analyzer which provides you with errors and warnings even
        >before you start executing, plus you can step through your code, watch
        >variables, etc.
        >
        >Good Luck
        >
        >GISkier
        >
        >--
        >View this message in context: http://www.nabble.com/process-the-list-in-reverse-order-in-batch-file-tp24846264p248779810.html
        >Sent from the Batch World mailing list archive at Nabble.com.
      • Theodorik OBroin
        Cheers mate ;o) 2009/8/8 foxidrive ... [Non-text portions of this message have been removed]
        Message 3 of 11 , Aug 8, 2009
        • 0 Attachment
          Cheers mate ;o)

          2009/8/8 foxidrive <foxidrive@...>

          >
          >
          >
          > Be careful with the URLs below - I don't think nabble.com it affiliated
          > with batchworld at all. They could be links with malware exploits.
          >
          >
          > On Sat, 8 Aug 2009 08:34:56 -0700 (PDT), giskier
          > <gonzaloi@... <gonzaloi%40steppingsoftware.com>> wrote:
          >
          > >
          > >In order to better debug your batch code, I recommend using Running Steps.
          >
          > >The batch debugger from Stepping Software (
          > http://www.steppingsoftware0.com).
          > >It has a code analyzer which provides you with errors and warnings even
          > >before you start executing, plus you can step through your code, watch
          > >variables, etc.
          > >
          > >Good Luck
          > >
          > >GISkier
          > >
          > >--
          > >View this message in context:
          > http://www.nabble.com/process-the-list-in-reverse-order-in-batch-file-tp24846264p248779810.html
          > >Sent from the Batch World mailing list archive at Nabble.com.
          >
          >


          [Non-text portions of this message have been removed]
        • giskier
          You can use a command in the form for /f %p in (myfile.txt) do call :ProcessLine %p goto :EOF ... rem Add code here to reverse the line (which is %* since its
          Message 4 of 11 , Aug 8, 2009
          • 0 Attachment
            You can use a command in the form

            for /f %p in (myfile.txt) do call :ProcessLine %p
            goto :EOF

            :ProcessLine
            rem Add code here to reverse the line (which is %* since its used as
            parameter in the call), and do all the processing you need here.

            Good Luck

            GISkier

            PS. If you don't trust the llink I sent, which is not malicious, just do a
            web search for "Running Steps debugger" and you will find this tool. It
            will be very helpful.



            Raagu wrote:
            >
            > Hello Thanks for wonderful reply. It worked fine..
            > But I have to execute this for loop multiple times and d number of times
            > determined by number files in a text file..
            >
            >
            > Here is the my snippet
            >
            > key=dependencies
            > for /f %%f in (myBuild\modules.txt) do (
            >
            > set revDepends=
            > set commaAdder=
            >
            > for /f "tokens=1-2 delims==" %%a in
            > (%%f\.zero\private\resolved.properties) do (
            > if %%a equ !key! (
            >
            > set str=%%b
            > )
            > )
            > echo !str!
            >
            >
            > :reverseLoop
            > for /F "tokens=1,* delims=," %%p in ("!str!") do (set
            > revDepends=%%p!commaAdder!!revDepends!&set str=%%q&set commaAdder=,)
            > if not "!str!" == "" goto :reverseLoop
            >
            > echo !revDepends!
            >
            >
            > )
            >
            > I wrote like this....
            > Here 'str' contains list of strings separated by comma after first inner
            > for loop
            >
            > myBuild/modules.properties contains two lines as below
            > demo
            > simple
            >
            > I want to execute your for loop twice for these two lines..
            > But In my code, the outer for loop executing only once..
            >
            > can u tel what is happening.
            >
            >
            >

            --
            View this message in context: http://www.nabble.com/process-the-list-in-reverse-order-in-batch-file-tp24846264p24881898.html
            Sent from the Batch World mailing list archive at Nabble.com.
          • giskier
            In your code to process each line you add the following (which will take the first five letters of the variable and compare to zero. (including period)). As
            Message 5 of 11 , Aug 9, 2009
            • 0 Attachment
              In your code to process each line you add the following (which will take the
              first five letters of the variable and compare to zero. (including period)).
              As you can see, if the comparison matches it jumps over the processing and
              returns without doing anything.


              :ProcessLine
              if /I "%reversefoo:~0,5" == "zero." goto :EndProcessLine
              ...
              do processing stuff here
              ...
              :EndProcessLine
              goto :EOF


              The last line (goto :EOF) is the return statement assuming you got to
              ProcessLine using "call :ProcessLine ....etc...". You can also return
              using "exit /B X" where X is a number. If you use this approach, upon
              returning %errorlevel% will be set to X.

              I hope this helps. Check the website for Stepping Software. You will find
              multiple interesting articles on interesting techniques to be applied in
              batch files. Plus the best batch file debugger: Running Steps 1.1.

              Good Luck.

              GISkier



              Raagu wrote:
              >
              > Thanks giskier... Your code worked fine.. [:)]
              > NOw I have one more thing to resolve.
              > I have a string "reverseFoo" which contains list of values , all are comma
              > separarted..
              > I have to process each one of them..
              >
              > I have to check each value .. If it starts with "zero." then I should
              > discard them , otherwise process them (simply echo them)..
              >
              > How Do I put it in for loop ???
              >
              > Please do reply
              >
              >
              >
              >
              > giskier wrote:
              >>
              >> You can use a command in the form
              >>
              >> for /f %p in (myfile.txt) do call :ProcessLine %p
              >> goto :EOF
              >>
              >> :ProcessLine
              >> rem Add code here to reverse the line (which is %* since its used as
              >> parameter in the call), and do all the processing you need here.
              >>
              >> Good Luck
              >>
              >> GISkier
              >>
              >> PS. If you don't trust the llink I sent, which is not malicious, just do
              >> a web search for "Running Steps debugger" and you will find this tool.
              >> It will be very helpful.
              >>
              >>
              >>
              >> Raagu wrote:
              >>>
              >>> Hello Thanks for wonderful reply. It worked fine..
              >>> But I have to execute this for loop multiple times and d number of times
              >>> determined by number files in a text file..
              >>>
              >>>
              >>> Here is the my snippet
              >>>
              >>> key=dependencies
              >>> for /f %%f in (myBuild\modules.txt) do (
              >>>
              >>> set revDepends=
              >>> set commaAdder=
              >>>
              >>> for /f "tokens=1-2 delims==" %%a in
              >>> (%%f\.zero\private\resolved.properties) do (
              >>> if %%a equ !key! (
              >>>
              >>> set str=%%b
              >>> )
              >>> )
              >>> echo !str!
              >>>
              >>>
              >>> :reverseLoop
              >>> for /F "tokens=1,* delims=," %%p in ("!str!") do (set
              >>> revDepends=%%p!commaAdder!!revDepends!&set str=%%q&set commaAdder=,)
              >>> if not "!str!" == "" goto :reverseLoop
              >>>
              >>> echo !revDepends!
              >>>
              >>>
              >>> )
              >>>
              >>> I wrote like this....
              >>> Here 'str' contains list of strings separated by comma after first inner
              >>> for loop
              >>>
              >>> myBuild/modules.properties contains two lines as below
              >>> demo
              >>> simple
              >>>
              >>> I want to execute your for loop twice for these two lines..
              >>> But In my code, the outer for loop executing only once..
              >>>
              >>> can u tel what is happening.
              >>>
              >>>
              >>>
              >>
              >>
              >
              >

              --
              View this message in context: http://www.nabble.com/process-the-list-in-reverse-order-in-batch-file-tp24846264p24887995.html
              Sent from the Batch World mailing list archive at Nabble.com.
            • giskier
              The link is not malicious. I am simply informing you of a great tool for batch files in a forum for batch files. If you don t want to click, just do a search
              Message 6 of 11 , Aug 9, 2009
              • 0 Attachment
                The link is not malicious. I am simply informing you of a great tool for
                batch files in a forum for batch files. If you don't want to click, just do
                a search on "Running Steps Debugger". You will find the same information I
                am giving you here.

                GISkier



                Theodorik OBroin wrote:
                >
                > Cheers mate ;o)
                >
                > 2009/8/8 foxidrive <foxidrive@...>
                >
                >>
                >>
                >>
                >> Be careful with the URLs below - I don't think nabble.com it affiliated
                >> with batchworld at all. They could be links with malware exploits.
                >>
                >>
                >> On Sat, 8 Aug 2009 08:34:56 -0700 (PDT), giskier
                >> <gonzaloi@... <gonzaloi%40steppingsoftware.com>> wrote:
                >>
                >> >
                >> >In order to better debug your batch code, I recommend using Running
                >> Steps.
                >>
                >> >The batch debugger from Stepping Software (
                >> http://www.steppingsoftware0.com).
                >> >It has a code analyzer which provides you with errors and warnings even
                >> >before you start executing, plus you can step through your code, watch
                >> >variables, etc.
                >> >
                >> >Good Luck
                >> >
                >> >GISkier
                >> >
                >> >--
                >> >View this message in context:
                >> http://www.nabble.com/process-the-list-in-reverse-order-in-batch-file-tp24846264p248779810.html
                >> >Sent from the Batch World mailing list archive at Nabble.com.
                >>
                >>
                >
                >
                > [Non-text portions of this message have been removed]
                >
                >
                >

                --
                View this message in context: http://www.nabble.com/process-the-list-in-reverse-order-in-batch-file-tp24846264p24888023.html
                Sent from the Batch World mailing list archive at Nabble.com.
              • foxidrive
                On Sun, 9 Aug 2009 08:14:26 -0700 (PDT), giskier ... How are these posts getting to batchworld? Are you gating them yourself? Do you have permission from
                Message 7 of 11 , Aug 9, 2009
                • 0 Attachment
                  On Sun, 9 Aug 2009 08:14:26 -0700 (PDT), giskier
                  <gonzaloi@...> wrote:

                  >
                  >The link is not malicious. I am simply informing you of a great tool for
                  >batch files in a forum for batch files. If you don't want to click, just do
                  >a search on "Running Steps Debugger". You will find the same information I
                  >am giving you here.
                  >
                  >GISkier

                  How are these posts getting to batchworld? Are you gating them yourself?
                  Do you have permission from Yahoo or the moderator?

                  I would welcome such an arrangement where the original posts arrive here as
                  well, but seeing *only* your followups and the text below made me very
                  suspcious.


                  >>> >View this message in context:
                  >>> http://www.nabble.com/process-the-list-in-reverse-order-in-batch-file-tp24846264p248779810.html
                  >>> >Sent from the Batch World mailing list archive at Nabble.com.

                  This isn't Nabble.com and only your user name is on these posts...
                • giskier
                  I missed the closing quote: %str:~0,5% Good Luck GISkier ... -- View this message in context:
                  Message 8 of 11 , Aug 9, 2009
                  • 0 Attachment
                    I missed the closing quote:

                    %str:~0,5%

                    Good Luck

                    GISkier



                    Raagu wrote:
                    >
                    > Hi I have tried this , But it didnt work
                    > I have tried simple example..
                    >
                    > set str = zero.core
                    >
                    > if /I "%str:~0,5" == "zero." echo HI
                    >
                    > It didnt print anything..
                    >
                    > What is the problem here ??
                    >
                    >
                    > giskier wrote:
                    >>
                    >> In your code to process each line you add the following (which will take
                    >> the first five letters of the variable and compare to zero. (including
                    >> period)). As you can see, if the comparison matches it jumps over the
                    >> processing and returns without doing anything.
                    >>
                    >>
                    >> :ProcessLine
                    >> if /I "%reversefoo:~0,5" == "zero." goto :EndProcessLine
                    >> ...
                    >> do processing stuff here
                    >> ...
                    >> :EndProcessLine
                    >> goto :EOF
                    >>
                    >>
                    >> The last line (goto :EOF) is the return statement assuming you got to
                    >> ProcessLine using "call :ProcessLine ....etc...". You can also return
                    >> using "exit /B X" where X is a number. If you use this approach, upon
                    >> returning %errorlevel% will be set to X.
                    >>
                    >> I hope this helps. Check the website for Stepping Software. You will
                    >> find multiple interesting articles on interesting techniques to be
                    >> applied in batch files. Plus the best batch file debugger: Running Steps
                    >> 1.1.
                    >>
                    >> Good Luck.
                    >>
                    >> GISkier
                    >>
                    >>
                    >>
                    >> Raagu wrote:
                    >>>
                    >>> Thanks giskier... Your code worked fine.. [:)]
                    >>> NOw I have one more thing to resolve.
                    >>> I have a string "reverseFoo" which contains list of values , all are
                    >>> comma separarted..
                    >>> I have to process each one of them..
                    >>>
                    >>> I have to check each value .. If it starts with "zero." then I should
                    >>> discard them , otherwise process them (simply echo them)..
                    >>>
                    >>> How Do I put it in for loop ???
                    >>>
                    >>> Please do reply
                    >>>
                    >>>
                    >>>
                    >>>
                    >>> giskier wrote:
                    >>>>
                    >>>> You can use a command in the form
                    >>>>
                    >>>> for /f %p in (myfile.txt) do call :ProcessLine %p
                    >>>> goto :EOF
                    >>>>
                    >>>> :ProcessLine
                    >>>> rem Add code here to reverse the line (which is %* since its used as
                    >>>> parameter in the call), and do all the processing you need here.
                    >>>>
                    >>>> Good Luck
                    >>>>
                    >>>> GISkier
                    >>>>
                    >>>> PS. If you don't trust the llink I sent, which is not malicious, just
                    >>>> do a web search for "Running Steps debugger" and you will find this
                    >>>> tool. It will be very helpful.
                    >>>>
                    >>>>
                    >>>>
                    >>>> Raagu wrote:
                    >>>>>
                    >>>>> Hello Thanks for wonderful reply. It worked fine..
                    >>>>> But I have to execute this for loop multiple times and d number of
                    >>>>> times determined by number files in a text file..
                    >>>>>
                    >>>>>
                    >>>>> Here is the my snippet
                    >>>>>
                    >>>>> key=dependencies
                    >>>>> for /f %%f in (myBuild\modules.txt) do (
                    >>>>>
                    >>>>> set revDepends=
                    >>>>> set commaAdder=
                    >>>>>
                    >>>>> for /f "tokens=1-2 delims==" %%a in
                    >>>>> (%%f\.zero\private\resolved.properties) do (
                    >>>>> if %%a equ !key! (
                    >>>>>
                    >>>>> set str=%%b
                    >>>>> )
                    >>>>> )
                    >>>>> echo !str!
                    >>>>>
                    >>>>>
                    >>>>> :reverseLoop
                    >>>>> for /F "tokens=1,* delims=," %%p in ("!str!") do (set
                    >>>>> revDepends=%%p!commaAdder!!revDepends!&set str=%%q&set commaAdder=,)
                    >>>>> if not "!str!" == "" goto :reverseLoop
                    >>>>>
                    >>>>> echo !revDepends!
                    >>>>>
                    >>>>>
                    >>>>> )
                    >>>>>
                    >>>>> I wrote like this....
                    >>>>> Here 'str' contains list of strings separated by comma after first
                    >>>>> inner for loop
                    >>>>>
                    >>>>> myBuild/modules.properties contains two lines as below
                    >>>>> demo
                    >>>>> simple
                    >>>>>
                    >>>>> I want to execute your for loop twice for these two lines..
                    >>>>> But In my code, the outer for loop executing only once..
                    >>>>>
                    >>>>> can u tel what is happening.
                    >>>>>
                    >>>>>
                    >>>>>
                    >>>>
                    >>>>
                    >>>
                    >>>
                    >>
                    >>
                    >
                    >

                    --
                    View this message in context: http://www.nabble.com/process-the-list-in-reverse-order-in-batch-file-tp24846264p24889682.html
                    Sent from the Batch World mailing list archive at Nabble.com.
                  • giskier
                    ... set HelpVar=%1 if /I %HelpVar:~0,5% == zero. ...etc... GISkier ... -- View this message in context:
                    Message 9 of 11 , Aug 9, 2009
                    • 0 Attachment
                      You can assign the parameter to a temporary variable and use the variable:

                      :compile
                      set HelpVar=%1
                      if /I "%HelpVar:~0,5%" == "zero." ...etc...

                      GISkier



                      Raagu wrote:
                      >
                      > ya it worked fine :)
                      > But in my code o am gettring str as a pameter from other piece of code..
                      >
                      > Here is my snippet
                      >
                      > :processEach
                      > for /F "tokens=1,* delims=," %%r in ("!revDepends!") do (set
                      > revDepends=%%s& call :compile %%r)
                      > if not "!revDepends!" == "%1" goto :processEach
                      >
                      > :compile
                      > echo %1
                      > if /I "%(%1):~0,5%" == "zero." echo HI
                      >
                      > How Do I put %1 (that conatns a single value , may be 'zero.core' ) in if
                      > condition...
                      >
                      >
                      >
                      >
                      > giskier wrote:
                      >>
                      >> I missed the closing quote:
                      >>
                      >> %str:~0,5%
                      >>
                      >> Good Luck
                      >>
                      >> GISkier
                      >>
                      >>
                      >>
                      >> Raagu wrote:
                      >>>
                      >>> Hi I have tried this , But it didnt work
                      >>> I have tried simple example..
                      >>>
                      >>> set str = zero.core
                      >>>
                      >>> if /I "%str:~0,5" == "zero." echo HI
                      >>>
                      >>> It didnt print anything..
                      >>>
                      >>> What is the problem here ??
                      >>>
                      >>>
                      >>> giskier wrote:
                      >>>>
                      >>>> In your code to process each line you add the following (which will
                      >>>> take the first five letters of the variable and compare to zero.
                      >>>> (including period)). As you can see, if the comparison matches it
                      >>>> jumps over the processing and returns without doing anything.
                      >>>>
                      >>>>
                      >>>> :ProcessLine
                      >>>> if /I "%reversefoo:~0,5" == "zero." goto :EndProcessLine
                      >>>> ...
                      >>>> do processing stuff here
                      >>>> ...
                      >>>> :EndProcessLine
                      >>>> goto :EOF
                      >>>>
                      >>>>
                      >>>> The last line (goto :EOF) is the return statement assuming you got to
                      >>>> ProcessLine using "call :ProcessLine ....etc...". You can also return
                      >>>> using "exit /B X" where X is a number. If you use this approach,
                      >>>> upon returning %errorlevel% will be set to X.
                      >>>>
                      >>>> I hope this helps. Check the website for Stepping Software. You will
                      >>>> find multiple interesting articles on interesting techniques to be
                      >>>> applied in batch files. Plus the best batch file debugger: Running
                      >>>> Steps 1.1.
                      >>>>
                      >>>> Good Luck.
                      >>>>
                      >>>> GISkier
                      >>>>
                      >>>>
                      >>>>
                      >>>> Raagu wrote:
                      >>>>>
                      >>>>> Thanks giskier... Your code worked fine.. [:)]
                      >>>>> NOw I have one more thing to resolve.
                      >>>>> I have a string "reverseFoo" which contains list of values , all are
                      >>>>> comma separarted..
                      >>>>> I have to process each one of them..
                      >>>>>
                      >>>>> I have to check each value .. If it starts with "zero." then I should
                      >>>>> discard them , otherwise process them (simply echo them)..
                      >>>>>
                      >>>>> How Do I put it in for loop ???
                      >>>>>
                      >>>>> Please do reply
                      >>>>>
                      >>>>>
                      >>>>>
                      >>>>>
                      >>>>> giskier wrote:
                      >>>>>>
                      >>>>>> You can use a command in the form
                      >>>>>>
                      >>>>>> for /f %p in (myfile.txt) do call :ProcessLine %p
                      >>>>>> goto :EOF
                      >>>>>>
                      >>>>>> :ProcessLine
                      >>>>>> rem Add code here to reverse the line (which is %* since its used as
                      >>>>>> parameter in the call), and do all the processing you need here.
                      >>>>>>
                      >>>>>> Good Luck
                      >>>>>>
                      >>>>>> GISkier
                      >>>>>>
                      >>>>>> PS. If you don't trust the llink I sent, which is not malicious, just
                      >>>>>> do a web search for "Running Steps debugger" and you will find this
                      >>>>>> tool. It will be very helpful.
                      >>>>>>
                      >>>>>>
                      >>>>>>
                      >>>>>> Raagu wrote:
                      >>>>>>>
                      >>>>>>> Hello Thanks for wonderful reply. It worked fine..
                      >>>>>>> But I have to execute this for loop multiple times and d number of
                      >>>>>>> times determined by number files in a text file..
                      >>>>>>>
                      >>>>>>>
                      >>>>>>> Here is the my snippet
                      >>>>>>>
                      >>>>>>> key=dependencies
                      >>>>>>> for /f %%f in (myBuild\modules.txt) do (
                      >>>>>>>
                      >>>>>>> set revDepends=
                      >>>>>>> set commaAdder=
                      >>>>>>>
                      >>>>>>> for /f "tokens=1-2 delims==" %%a in
                      >>>>>>> (%%f\.zero\private\resolved.properties) do (
                      >>>>>>> if %%a equ !key! (
                      >>>>>>>
                      >>>>>>> set str=%%b
                      >>>>>>> )
                      >>>>>>> )
                      >>>>>>> echo !str!
                      >>>>>>>
                      >>>>>>>
                      >>>>>>> :reverseLoop
                      >>>>>>> for /F "tokens=1,* delims=," %%p in ("!str!") do (set
                      >>>>>>> revDepends=%%p!commaAdder!!revDepends!&set str=%%q&set commaAdder=,)
                      >>>>>>> if not "!str!" == "" goto :reverseLoop
                      >>>>>>>
                      >>>>>>> echo !revDepends!
                      >>>>>>>
                      >>>>>>>
                      >>>>>>> )
                      >>>>>>>
                      >>>>>>> I wrote like this....
                      >>>>>>> Here 'str' contains list of strings separated by comma after first
                      >>>>>>> inner for loop
                      >>>>>>>
                      >>>>>>> myBuild/modules.properties contains two lines as below
                      >>>>>>> demo
                      >>>>>>> simple
                      >>>>>>>
                      >>>>>>> I want to execute your for loop twice for these two lines..
                      >>>>>>> But In my code, the outer for loop executing only once..
                      >>>>>>>
                      >>>>>>> can u tel what is happening.
                      >>>>>>>
                      >>>>>>>
                      >>>>>>>
                      >>>>>>
                      >>>>>>
                      >>>>>
                      >>>>>
                      >>>>
                      >>>>
                      >>>
                      >>>
                      >>
                      >>
                      >
                      >

                      --
                      View this message in context: http://www.nabble.com/process-the-list-in-reverse-order-in-batch-file-tp24846264p24894024.html
                      Sent from the Batch World mailing list archive at Nabble.com.
                    • procyon50@gmail.com
                      Batch file links and help, assembled by Matthias Tacke with some links from other helpful posters: Please note that some links may be out of date For help on
                      Message 10 of 11 , Aug 10, 2009
                      • 0 Attachment
                        Batch file links and help, assembled by Matthias Tacke with some links from
                        other helpful posters: Please note that some links may be out of date

                        For help on Dos commands and syntax type this in a dos cmd window

                        For W2K: HH windows.chm::ntcmds.htm
                        For XP: HH ntcmds.chm

                        or search your windows help manually.

                        Mostly batch related links for NT/W2K/XP
                        ========================================

                        Microsoft Windows XP - Command-line reference A-Z
                        http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds.mspx

                        Microsoft Windows Server 2003 - Command-line reference A-Z (January
                        21,2005)
                        http://technet2.microsoft.com/WindowsServer/en/library/552ed70a-208d-48c4-8da8-2e27b530eac71033.mspx

                        Microsoft Windows XP Pro - Cmd
                        http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/cmd.mspx

                        http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/batch.mspx#top
                        http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/batch.mspx
                        http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/redirection.mspx?mfr=true
                        http://www.labmice.net/articles/batchcmds.htm
                        http://www.ss64.com/nt/index.html
                        http://www.commandline.co.uk/lib/treeview/index.php
                        http://www.uwasa.fi/~ts/http/http2.html#cmdscript
                        http://www.uwasa.fi/~ts/http/http2.html
                        http://www.westmesatech.com/cmdprompt.html
                        http://www.robvanderwoude.com/


                        DOS/w9x/ME
                        http://www.allenware.com/icsw/icswidx.htm
                        http://www.maem.umr.edu/batch/batchtoc.htm
                        http://en.wikipedia.org/wiki/Microsoft_operating_system_batch_programming
                        http://www.computerhope.com/batch.htm
                        http://home7.inet.tele.dk/batfiles/
                        http://www.ericphelps.com/batch/
                        http://www.uwasa.fi/~ts/http/http2.html#batch
                        http://www.uwasa.fi/~ts/http/http2.html
                        http://www.merlyn.demon.co.uk/
                        http://www.chebucto.ns.ca/~ak621/DOS/
                        http://www.computerhope.com/batch.htm
                        http://www.tnd.com/camosun/elex130/dosbatchtutor1.html

                        Or search these groups. Replace "your+keywords" with your keywords

                        http://groups.google.com/groups?group=alt.msdos.batch&q=your+keywords
                        http://groups.google.com/groups?group=alt.msdos.batch.nt&q=your+keywords
                        http://groups.google.com/groups?group=alt.msdos.batch.*&q=your+keywords
                        http://groups.google.com/groups?group=microsoft.public.win2000.cmdprompt.admin&q=your+keywords

                        or directly open the advanced Group Search page with pre-entered group:
                        http://groups.google.com/advanced_group_search?group=alt.msdos.batch
                        http://groups.google.com/advanced_group_search?group=alt.msdos.batch.nt
                        http://groups.google.com/advanced_group_search?group=alt.msdos.batch.*
                        http://groups.google.com/advanced_group_search?group=microsoft.public.win2000.cmdprompt.admin

                        If you are using internet explorer as your browser take a look here:
                        http://www.commandline.co.uk/searchurl/index.html
                        where Ritchie Lawrence outlines out how to improve searching.
                      • giskier
                        There are 2 ways to return from a call 1) goto :EOF 2) exit /B X In way 2, X is a number, and the errorlevel variable will be set to X. Example for %p in
                        Message 11 of 11 , Aug 10, 2009
                        • 0 Attachment
                          There are 2 ways to return from a call

                          1) goto :EOF
                          2) exit /B X

                          In way 2, X is a number, and the errorlevel variable will be set to X.

                          Example

                          for %p in (one two three) do call :showParam

                          :ShowParam
                          echo %1
                          goto :EOF


                          Good Luck

                          GISkier

                          Raagu wrote:
                          >
                          > oh ok Thanks...
                          >
                          > Now
                          >
                          > I have a bat script which conatins a for loop
                          >
                          > for ******** do call :LABEL1
                          >
                          > :LABEL1
                          > // here my code
                          >
                          > :LABEL2
                          > //mycode
                          > goto :LABEL3
                          >
                          > :LABEL3
                          > //bla bla
                          >
                          >
                          >
                          >
                          > :LABEL4
                          >
                          >
                          > Here After :LABEL3 completes it should go to for loop again for next
                          > iteration..
                          > That is I want to execute first three LABELS for each iteration of for
                          > loop.. after finished that LABEL4 should be executed..
                          > when one condition satisfies within for loop, then it should go to LABEL4
                          > and execute from there..
                          >
                          > Now In my code after :LABEL3 it is coming to LABEL4 .. I dont want that..
                          > ANd after :LABEL3 i cant put goto for loop because , In for loop i am
                          > accessing a file,, So it will start from the beginning..
                          >
                          > What do I Do for this ??
                          > please reply..
                          >
                          >

                          --
                          View this message in context: http://www.nabble.com/process-the-list-in-reverse-order-in-batch-file-tp24846264p24911485.html
                          Sent from the Batch World mailing list archive at Nabble.com.
                        Your message has been successfully submitted and would be delivered to recipients shortly.