简体   繁体   English

任务计划程序Windows 10

[英]Task scheduler Windows 10

I guess this is easy but is eluding me, I have a working Powershell script that I wish to run as a Scheduled Task in Windows 10, however the script does not execute from the Task scheduler. 我想这很容易,但让我不知所措,我有一个正常工作的Powershell脚本,希望在Windows 10中作为计划任务运行,但是该脚本无法从任务计划程序执行。

Script is hider.ps1 脚本是hider.ps1

$fs = New-Object -ComObject scripting.filesystemobject
Get-ChildItem "D:\TV Shows\" -force | Where-Object {$_.psiscontainer} | ForEach-Object {
    if($fs.getfolder($_.fullname).size -lt 20mb) {$_.attributes = "directory,hidden"}
    else{$_.attributes = "directory"}
}

This hides empty folders in a directory 这将隐藏目录中的空文件夹

In Task scheduler I have put 在任务计划程序中,我已将

Start a program Powershell 启动程序Powershell

Arguments -ExecutionPolicy Bypass –File "F:\\Xaved Files\\Hider ps 1" 参数-ExecutionPolicy Bypass –File "F:\\Xaved Files\\Hider ps 1"

Have you set the "start in" directory??? 您是否设置了“开始于”目录???

Apparently, since windows server 2012, if a task doesn't have this field informed, the task doesn't run silently. 显然,自Windows Server 2012起,如果任务没有通知此字段,则该任务不会静默运行。

This worked in my case, and also to this guy 就我而言, 这也有效

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 来自 Windows 10 任务调度程序的 Powershell 脚本未启动 Chrome - Powershell script from Windows 10 task scheduler not launching Chrome Windows 调度程序未执行任务 - Windows scheduler not executing task 如何使用 PowerShell 在系统重新启动后延迟 10 分钟在 Windows 任务调度程序中调度任务? - How to schedule a task in Windows Task Scheduler with delay of 10 minutes after system restarted using PowerShell? 任务计划未执行可通过任务计划程序(Windows10)手动运行的Powershell脚本 - Task Scheduling not executing a Powershell script that can be manually run through Task Scheduler (Windows10) 使用 Windows 任务调度程序的任务持续时间 - Duration of tasks with Windows Task scheduler 编辑 Windows 任务计划程序任务的触发器 - Edit triggers for a Windows Task Scheduler Task Windows Task Scheduler Powershell脚本完成并重新启动 - Windows Task Scheduler Powershell Script complete and restart Windows Server 2019 任务计划程序中的 Powershell 命令? - Powershell Command in Windows Server 2019 Task Scheduler? Windows Task Scheduler —无法运行Powershell脚本 - Windows Task Scheduler — Fails to run Powershell Scripts 在Windows Task Scheduler上运行PowerShell的问题 - Issue Running PowerShell on Windows Task Scheduler
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM