Hello! I’m pretty new to PowerShell, but I can’t find an answer to this.
I’m trying to convert one of my FFmpeg cmd scripts to PowerShell, but I can’t figure this out for the life of me
FFprobe responds to a query with a fraction in string format, how can I get that into a double?
This isn’t possible in the command line, as there’s no floating-point support there, there was a workaround using visual basic scripts.
I was hoping that wasn’t needed in PS, but I can’t find a way to solve this seemingly simple problem.
code:
$string = "15/2" $double = [double]$string Write-Host $double
Results in
Cannot convert value "15/2" to type "System.Double". Error: "Input string was not in a correct format." FullyQualifiedErrorId : InvalidCastFromStringToDoubleOrSingle
Is there a way to do this in PowerShell?