【发布时间】:2019-01-29 03:31:56
【问题描述】:
在 powershell 中(管理员与否)C:\Users\mine\Desktop\LOL\test.ps1 在没有 schtasks 的情况下可以正常工作,但是当我使用它创建 schtasks 时,它无法正常工作。什么都没发生。
test.ps1可以在powershell中正常运行。
当我查询schtasks 时,出现“备份数据库”,状态已准备就绪。
假设我将其设置为10:08。
当我在10:08 之前查询时,下一个运行时间是今天10:08。
当我在10:08 之后查询时,下一个运行时间是明天10:08,
但中间什么也没发生。
PS C:\Users\mine> Schtasks /create /tn "Backup DB" /sc daily /st 10:08 /tr "C:\Users\mine\Desktop\LOL\test.ps1"
WARNING: The task name "Backup DB" already exists. Do you want to replace it (Y/N)? y
SUCCESS: The scheduled task "Backup DB" has successfully been created.
简而言之,我想每天使用 powershell 运行我的test.ps1
【问题讨论】:
-
正常创建,程序为
powershell.exe,参数为-File C:\Users\mine\Desktop\LOL\test.ps1 -
@Drew 仍然没有发生任何事情。我不知道出了什么问题。
标签: powershell windows-task-scheduler