Looking for guidance on performing substring extraction in a batch script on the variable of a command output. Specifically the command I am using is powershell (Get-CimInstance Win32_OperatingSystem).version
I have this variable set up successfully using for /f "tokens=*" %%i in ('"powershell (Get-CimInstance Win32_OperatingSystem).version"') do set OSvar=%%i
As you can see I am querying OS version, and I have an undisclosed, semi-valid use case for using this specific method to find it. Even if my reasoning behind using the above method to query may be misguided, I still want to learn how to perform substring extraction on this output, for my own edification. Finding a solution is less important than finding a solution in the given context.
Obviously, this will output something to the effect of "6.2.9200", "6.3.9600", or "10.0.XXXXXXX". I want to know how to extract the output before the 2nd decimal, but all of the attempts I've tried after researching are failing, including setting delims and using a second variable set equal to the first with :~0,3%. Can the gurus here help a guy out?