iT邦幫忙

0

Background commands in Windows

I would like to run ping every 30 minutes by schedule but no showing result in console. How to do in Windows XP ?

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

28
funkent
iT邦高手 1 級 ‧ 2009-03-20 11:26:37
最佳解答

Step 1. 先Create 一個 batch file (如範例的 ping.cmd ,會去ping www.google.com.tw並且把ping的結果存到 D:\ping.txt,如果要紀錄每次的結果請把 > 變成 >>)

<pre class="c" name="code">
C:\WINDOWS\system32\ping.exe www.google.com.tw>d:\ping.txt
exit

Step 2. Create 一個 VBS 讓 ping.cmd run 的時候不要create 視窗 (如範例中的 ping.vbs 會去執行 D:\ping.cmd (請把Step 1 Create 的 cmd file 命名為ping.cmd並放到D:\))

<pre class="c" name="code">
Set WshShell = CreateObject("WScript.Shell")
cmds=WshShell.RUN("d:\ping.cmd", 0, True)
Set WshShell = Nothing 

Step 3.Create 一個排定中的工作,選擇執行Step 2 中的 VBS file,並在排程中的進階選項設定每30分鐘執行一次。

我要發表回答

立即登入回答