windows - 一次启动3个Windows服务,它们之间有延迟

标签 windows powershell service

我是PowerShell的新手,我需要编写脚本以特定顺序启动3个或更多Windows服务,并且它们之间有一定的延迟。我知道如何编写脚本来启动所有脚本,但是我不知道如何设置延迟:

Get-Service -ComputerName cumputer_name -Name service_name1 | Stop-Service -Verbose
Get-Service -ComputerName cumputer_name -Name service_name2 | Stop-Service -Verbose

最佳答案

我相信您正在寻找Start-Sleep

Get-Service -ComputerName cumputer_name -Name service_name1 | Stop-Service -Verbose
Start-Sleep -Seconds 5
Get-Service -ComputerName cumputer_name -Name service_name2 | Stop-Service -Verbose

关于windows - 一次启动3个Windows服务,它们之间有延迟,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62878342/

相关文章:

service - 开源项目的免费构建服务器服务?

java - 后台和前台执行服务

linux - .htaccess 和 dns 将 windows hosted .com 网站重定向到我的 linux .co.za wordpress 网站

powershell - 巧克力包没有通过 Windows 10 中的 OneGet/PackageManagement 安装?

powershell - PowerShell 中的 filter 关键字有什么作用?

sql-server - sqlpackage表列表

android - AIR Native Extension 无法启动服务 Intent Android GCM

c++ - 一万个单位圆以上,如何画出高性能?

windows - Sublime Text 2 Mouse free 从 "Find in Files"结果打开文件

windows - 获取文件名前的部分字符串作为目录