This is working in cmd:
"C:\Program Files (x86)\CodeMeter\Runtime\bin\cmu32.exe" --list-content | FIND "Serial Number 12345-"
Output (correctly extracted from multiple lines):
CmContainer with Serial Number 12345-67890 and version 1.19 (locked)
But I want to make it work in a .bat file and store the result to a variable (from here):
for /f "usebackq" %%i in (`"C:\Program^ Files^ ^(x86)\CodeMeter\Runtime\bin\cmu32.exe" --list-content ^| FIND "Serial Number 12345-"`) do SET foobar=%%i
it throws:
The filename, directory name, or volume label syntax is incorrect.
PS: in the final version I'd like to use system variables for the path, like "%PROGRAMFILES(X86)%\CodeMeter\Runtime\bin\cmu32.exe"
, but while that does not make a difference in cmd, it throws "'C:\Program' is not recognized as an internal or external command, operable program or batch file." when called from within a .bat... so I guess there are escaping issues?