我在文本文件中导出驱动器名称电影。
Get-WmiObject win32_logicaldisk| foreach-object {$volumename -Match "movies" } | select movies > c:\nn.txt
后来比较它但不成功总是得到错误的结果有人可以帮忙吗?
$test=Get-WmiObject win32_logicaldisk| foreach-object {$volumename -Match "movies" } | select movies > c:\nn.txt
$array =get-content c:\nn.txt
$real= Get-WmiObject win32_logicaldisk| foreach-object {$volumename -Match "movies"} | select movies
If ($array -eq $real)
{write-host "it was success" -foregroundcolor blue}
Else {write-host "it was fail" -foregroundcolor green}
1 个回答