简体   繁体   English

Powershell文件下载和任务计划程序

[英]Powershell file download and Task Scheduler

I am a beginner. 我是初学者。 I tried to schedule a download with local Windows 10's powershell. 我尝试使用本地Windows 10的Powershell安排下载。 Tested in powershell, the script work and successful download the files. 该脚本在powershell中进行了测试,可以正常工作并成功下载文件。

$client = (new-object System.Net.WebClient).DownloadFile("http://example.com&format=xml&limit=50","C:\folder\1-50.xml")

However, when I tried to schedule in Windows Task Scheduler(Since there are 24 xml indeed) Scheduler Setting 但是,当我尝试在Windows Task Scheduler中进行计划时(由于确实存在24个xml), 计划程序设置

It always runs into errors. 它总是会出错。 eg missing ')' in method call... unexpected token... the ampersand (&) character is not allowed... 例如在方法调用中缺少')'...意外的令牌...不允许在&字符之间使用...

Think it should be some syntax error on the Task Scheduler side, but I am not sure what to update as I learnt the powershell script from Googleing only 认为这应该是Task Scheduler方面的一些语法错误,但是我不确定要更新什么,因为我仅从Googleing学习了powershell脚本

What should I update on the command? 我应该在命令上更新什么? Or should I use other script to achieve that instead? 还是应该使用其他脚本来实现?

在powershell中,有一种使用Invoke-WebRequest来下载文件的简单方法:

Invoke-WebRequest $URL -OutFile $Path

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM