Windows PowerShell检测Service是否存在并删除 Benson 2022年3月7日 2022年3月23日 检测Windows Service是否存在,如果存在,就先删除原有的Service。这是PowerShell脚本。 其中, Get-Service $ServiceName 如果Service不存在,就会报错。 加上-ErrorAction SilentlyContinue,可以忽略错误,继续执行。$? 用于检验上一条语句执行是否成功。