![]() But if you should ever need delayed expansion, then you can have problems, as demonstrated below. Every line of WMIC output will have the extra trailing carriage return.Īs long as you always access RESULT using %RESULT% (normal expansion), then you will not have any problems. This is due to a quirk with how FOR /F handles WMIC unicode output. You can't see it with the above code, but RESULT actually contains a trailing carriage return (0x0D). 'wmic datafile where "name='C:\\Program Files (x86)\\Common Files\\Company\\Product\\Version12\\Product.exe'" get version /format:list'īut this may not quite be the whole solution. You can put double quotes around the WHERE clause (not including the WHERE keyword) to avoid some escape issues within the FOR DO() clause. WMIC uses SQL syntax, and strings are enclosed in single quotes.The internal single quotes do not interfere with the command enclosing single quotes. You have a set of misplaced double quotes, as well as an extra (.
0 Comments
Leave a Reply. |