there's a certain level of sadness you have to reach to learn how to do a for-loop in batch scripting
-
@foone so you do that recursively?
-
irina 🌷🐇 friend of eggbugreplied to Foone🏳️⚧️ last edited by
@foone i've gotten to this point a few times and just decided "hm. no, the user can install python for this"
-
@funkylab yeah I'm a recursive sicko
-
Foone🏳️⚧️replied to irina 🌷🐇 friend of eggbug last edited by
@irina yeah that's my usual option. I can write a 5 line python program that does what a 2 line batch program can do, but at least I'll understand it
-
@mcc AHHHHHHHHHHHHHHH MSBUILD
one of my previous jobs involved automating MSBuild and it was an endless nightmare
-
@foone i have become comfortable with it , like a horrible cursed glave. i have created works of startling complexity in it. msbuild is the thing that means I don't have to learn how to learn batch
-
-
-
@mcc @foone When I worked at IBM, I briefly had a local instance of IBM WebSphere on my work laptop. At that time, the entire build system comprised hundreds of batch scripts calling each other, and documentation was non-existent. It took me two full days of fiddling to get it built, between the raw build time and having to modify the process on the fly because our environment was not exactly the same as that of the team that originally produced it.
-
-
@foone is it even possible without a goto?
-
@eltonfc yeah! There's a "for" statement which iterates over a list and does some variable replacement stuff per iteration.
for /l %%x in (1, 1, 100) do echo %%x
-
@foone IIRC the batch
for
command isn't a loop in the usual sense. It first builds a list of input strings (in various ways, depending on how you invokefor
), then uses the "loop body" as a template string to replicate and substitute the current input string into (mail merge style). Finally, it takes the "loop bodies" with input values interpolated into them, concatenates them all, and evals the result.This has certain implications for performance, loop control, and the way regular
%variables%
work in these "loops". -
@barubary given everything I know about Microsoft, that doesn't surprise me in the slightest