For /f batch file loop not working?

doublebeep7's Avatar

doublebeep7

18 Dec, 2018 12:01 PM

Hi,

Recently, I decided to replace most of the PowerShell code with batch file code in my appveyor.yml file. I had to put a for /f loop to parse the output of two commands and some more to parse textfiles. But this doesn't work. I have tried it both locally and in RDP and woking fine!

Some examples:
1. https://ci.appveyor.com/project/double-beep/asmfish-i5x4k/build/job...
2. https://ci.appveyor.com/project/double-beep/asmfish-i5x4k/builds/21...

and some more similar examples. Why this happens only in the console and not locally or remotely?

  1. Support Staff 1 Posted by Owen McDonnell on 18 Dec, 2018 07:02 PM

    Owen McDonnell's Avatar

    Please demonstrate where you think AppVeyor is not working via a minimal repro of the error.
    In this case, you can simply start a project with one single text file and run those commands in init stage.

  2. 2 Posted by doublebeep7 on 19 Dec, 2018 11:55 AM

    doublebeep7's Avatar
  3. Support Staff 3 Posted by Owen McDonnell on 19 Dec, 2018 05:24 PM

    Owen McDonnell's Avatar

    Just add another % to the loop parameter.
    change

    for /f "delims=" %B IN ('ver') do echo %B
    
    to
    for /f "delims=" %%B IN ('ver') do echo %%B
    
  4. Owen McDonnell closed this discussion on 19 Dec, 2018 05:24 PM.

  5. doublebeep7 re-opened this discussion on 20 Dec, 2018 03:16 PM

  6. 4 Posted by doublebeep7 on 20 Dec, 2018 03:16 PM

    doublebeep7's Avatar

    Thanks for replying; it works fine. Why should I double percent-signs? My code isn't running from cmd?

  7. 5 Posted by doublebeep7 on 04 Jan, 2019 03:19 PM

    doublebeep7's Avatar

    This has not attracted so much attention. Closing so...

  8. doublebeep7 closed this discussion on 04 Jan, 2019 03:19 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

 

26 Sep, 2024 03:49 PM
26 Sep, 2024 09:02 AM
25 Sep, 2024 07:07 PM
24 Sep, 2024 08:39 PM
24 Sep, 2024 06:47 AM
20 Sep, 2024 05:50 PM