0
調試時,$var
不等同於「folder\that\isNot\equivalent\".
條件判斷是正確的,但在返回false
我試圖將其更改爲一個等價的語句,但它不工作。任何有識之士將不勝感激。
這裏是所有相關代碼:
$process = "Explorer++.exe"
$var = Get-WmiObject Win32_Process -Filter "name = '$process'" | select -expandproperty CommandLine
$var = $var -split '\\\\' | select -Last 1
Write-Host $var
if ($var -ne "folder\that\isNot\equivalent\")
{
Stop-Process -processname explorer++
Stop-Process -processname curProc
}
else
{
return $true
}
存儲在'$ var'和'$ process'在'寫Host'行什麼樣的價值觀? – Bassie
@Bassie 執行寫主機時: $ var ='folder \ that \ isnot \'作爲System.String '$ process =「Explorer ++。exe」'也作爲System.String。 – Bridger