If I have a certain folder with a number of .txt files, each contain a single curl cmd in a single line, I want to be just able to point to the folder then all of these commands are launched once, preferably in the ascending order of their file modification date and preferably the output of each command is saved in a file (just one file for all, with separation format in between).
I tried a .bat solution as follows but a 8kb file (or command) doesn't run correctly, despite that I just opened the .txt file in which the command is and copied it directly into cmd, it works:
@echo off setlocal enabledelayedexpansion :: Loop through all .txt files in the current folder (excluding this batch script itself) for %%f in (*.txt) do ( set "cmd=" :: Read the content of each file (e.g., 1.txt, 2.txt, etc.) for /f "delims=" %%a in (%%f) do ( set "cmd=!cmd! %%a" ) :: Execute the command echo Executing: %%f cmd /c "!cmd!" ) ) pause endlocal Other 3-4 kb commands run well.
@echo offand inspect the output carefully.