I am using PowerShell to get the File Version of a file
C:\WINDOWS\system32>powershell (Get-Command C:\Users\lafarnum\Downloads\aniteloggingclientapi.dll).FileVersionInfo.FileVersion 1.12.0.4
The output file version is 1.12.0.4. I wanted to pipe this file version into a DOS CMD variable like a normal assignment but the issue is it is simply assigning the PowerShell command string , not the output of the PowerShell command
C:\WINDOWS\system32>set pfpathset=powershell (Get-Command C:\Users\lafarnum\Downloads\aniteloggingclientapi.dll).FileVersionInfo.FileVersion
C:\WINDOWS\system32>echo %pdpathset% %pdpathset%
C:\WINDOWS\system32>echo %pfpathset% powershell (Get-Command C:\Users\lafarnum\Downloads\aniteloggingclientapi.dll).FileVersionInfo.FileVersion
C:\WINDOWS\system32>
So the PS command output does not seem to be directly directed to the CMD STDOUT output? So do I have to pipe the output of the PS command into another string variable and then assign that variable to my pfpathset variable? or do I have to use a ps script to do this?
Sorry if this is a basic question but I am a powershell novice, so any help given would be appreciated.
Thanking you in anticipation