How to extract a set of commands from a bat file respecting certain pattern and run them in bach?
example : file.txt
export TOOLCHAIN="multi" # Version of toolchain (optional) # Location of toolchain (optional for WINDOWS) export TOOLPATH="D:/Tools/compiler/GHS/GHS_COMPILER/PPC" in this example, I'm looking for a command which could
- find all the lines starting with
export - extract the command
- run the command
output:
set TOOLCHAIN="multi" set TOOLPATH="D:/Tools/compiler/GHS/GHS_COMPILER/PPC"
for /F "tokens=1*" %%a in ('findstr "^export" file.txt') do set %%bBTW your description is confusing; you want not to "run the command", but to "set a variable with the command"...