[英]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.