简体   繁体   中英

Windows Task Scheduler to execute .aspx page using Powershell

I want to use Windows Task Scheduler to execute my ASP.NET web page (.aspx). I read that Windows Powershell can help in this. The post asp.net script in task scheduler

tells a command "powershell.exe -c (new-object system.net.webclient).downloadstring(' http://localhost/myscript.aspx ')" to execute .aspx page. But I'm unable to add this line into Windows Task Scheduler, (I'm using Windows XP)

In the run field of the scheduled task:

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

That's it.

在此处输入图片说明

You can create a powershell file like task.ps1 with the command you have shown and schedule execution of this ps1 file.

Such file should not contain powershell.exe command.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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