|
Answer» I am trying to write a a BAT file that can do something like this:
Set myvar=findstr "look for this text" In_This_File.txt
The result of any command into a variable.
How is it DONE?
You need to execute your PROGRAM within a subshell with the variable expansion DELAYED:
cmd /v: on
then, you can execute:
Code: [Select]set var= for /f "tokens=*" %%A in ('findstr "look for this text" file.txt') do set myVar=!myVar!%%A echo %myVar% [size=56]THANKS![/size]
You have no idea on how much I have been searching the NET for that. Now, I just have to figure out what it actually does. :-) It works nicely though, I just tested it.
|