windows - 计划的 Powershell 脚本(WindowStyle Hidden)自动终止
问题描述
我需要安排在内部调用 bat 脚本并每分钟运行一次的 powershell 脚本。
script1.bat
一些写入 csv 文件的 echo 命令。
脚本2.ps1:
Invoke-RestMethod <URL>
./script1.bat
脚本3.ps1
./script2.ps1
sleep 60
所以 script3.ps1 在 cmd 中使用以下命令进行调度。
start /min powershell -WindowStyle Hidden -Command .\script2.ps1
所以预定的脚本(script3.ps1)按预期每分钟运行一次。但是几个小时后,脚本会自动终止。使用以下命令检查隐藏进程是否正在运行。
Get-WmiObject Win32_Process -filter "CommandLine LIKE '%powershell -WindowStyle Hidden%'"
几个小时后我没有看到该过程运行。任何人都可以建议为什么后台隐藏的运行进程被杀死。
解决方案
推荐阅读
- load-balancing - 如何使用忽略客户端 IP 的 Haproxy 粘性会话?
- c# - 用户未通过登录控制 ASP .NET 进行身份验证
- swift - Swift 4:直接在结构或类中的 getter 和 setter
- xaml - 如何让我的按钮填满 Xaml 中的屏幕
- c++ - 本征,用四元数旋转vector3d?
- asp.net-core-2.0 - Database.Migrate() 创建数据库但不创建表,EF & .NET Core 2
- ionic3 - 如何使用 Ionic 3 和 Angular 5 动态启用或禁用 ion-range-slider?
- angular - `of` 运算符和 `Observable.of` 之间的区别
- c++ - C++ - Chromium 指南样式冲突虚拟覆盖
- java - Java Selenium Webdriver Sendkeys同时输入Variable AND Keys