我有以下脚本来安装 topshelf 服务:
$exePath = "./My.exe"
$service = get-service | Where {$_.Name -eq "MyService"}
if($service -ne $null) {
Write-Host "Service already installed, will do a reinstall"
if($service.Status -eq "Running") {
Write-Host "Stopping service"
& $exePath stop
}
Write-Host "Uninstalling service"
& $exePath uninstall
}
Write-Host "Installing service"
& $exePath install
Write-Host "Starting service"
& $exePath start
当我运行这个脚本时,我必须在每一步之间按回车键。有没有解决的办法?