我想編寫一個簡單的If語句來檢查一個進程是否存在。 如果存在,應該開始。Powershell獲取進程查詢
這樣,但工作..;)
If ((Get-Process -Name Tvnserver.exe) -eq $True)
{
Stop-Process tnvserver
Stop-Service tvnserver
Uninstall...
Install another Piece of Software
}
Else
{
do nothing
}
感謝
對於否定條件,只需將'-eq $ null'更改爲'-ne $ null'。 – 2013-02-24 18:19:09
好的,它的工作原理!非常感謝! – Daniel4711 2013-02-25 12:18:14
不客氣。 – 2013-02-25 12:32:03