时间:2022-01-04 10:56:17 | 栏目:.NET代码 | 点击:次
可能也有其他方法,比如用 WGet 等等,但是 推荐用 PowerShell ,为什么呢,因为 PowerShell 太强大呗
PowerShell 语法(demo1.ps1):
#if the time is right
if(($minuteCount -le $endTime ) -and ($minuteCount -ge $beginTime ))
{
#send request
$webClient = new-object System.Net.WebClient;
$webClient.Headers.Add("user-agent","PowerShell Script");
$webClient.Headers.Add("Referer","PowerShell Script");
$url = "https://www.jb51.net/enAdmin/Handler/Listen_cms.ashx?code=listen_cms_20111130876";
$message = $webClient.DownloadString($url);
#write log
write("Message:"+$message);
}
else
{
write("Not Update");
}
sleep 5