例如,我试图从cmdlet获取值,将其另存为int并在PowerShell脚本的if语句或while语句中使用它。
$ value = Get-WmiObject -Class Win32_logicaldisk -Filter“ DriveType ='2'” |选择对象大小echo $ value
Size
----
1992032256 <------- I am trying to get that number so that I can use it in a if statement and compare it with another number
例如:
$value = Get-WmiObject -Class Win32_logicaldisk -Filter "DriveType = '2'"
$value.size