Windows任务计划程序使用Powershell执行.aspx页面

时间:2012-01-18 06:54:37

标签: asp.net windows powershell webpage execute

我想使用Windows任务计划程序来执行我的ASP.NET网页(.aspx)。我读到Windows Powershell可以为此提供帮助。帖子asp.net script in task scheduler

告诉命令“powershell.exe -c(new-object system.net.webclient).downloadstring('http://localhost/myscript.aspx')” 执行.aspx页面。但我无法将此行添加到Windows任务计划程序中(我使用的是Windows XP)

2 个答案:

答案 0 :(得分:1)

在计划任务的运行字段中:

powershell.exe -command "(new-object system.net.webclient).downloadstring('http://localhost/myscript.aspx')"

就是这样。

enter image description here

答案 1 :(得分:0)

您可以使用您显示的命令创建一个powershell文件,例如task.ps1,并安排执行此ps1文件。

此类文件不应包含powershell.exe命令。