0

I'm making following batch script

set FileVersion = powershell (Get-Command C:\Tool.exe).FileVersionInfo.ProductVersion

echo %FileVersion%

I'd like retrieve attribute 'Product Version' of file C:\Tool.exe. To do that I use a powershell command and I want save that value to a variable called 'File Version' and later print out it, but it doesnt works! Can you help me?

1

1 Answer 1

1

For some yet to be understood logic, a FOR loop must be used.

FOR /F "delims=" %%A IN ('powershell (Get-Command C:\Tool.exe).FileVersionInfo.ProductVersion') DO (SET "FileVersion=%%~A")
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.