2015-10-23 63 views
3

我需要使用批處理文件或VBScript以編程方式刷新桌面和任務欄圖標。刷新桌面和任務欄中的所有圖標

,我發現這個VBS命中通常刷新鍵,F5

Set WSHShell = CreateObject("WScript.Shell") 
WshShell.SendKeys "{F5}" 

但顯然好好嘗試一下刷新我提到的圖標。

+0

你的問題沒有任何意義。 –

+1

請不要鏈接可下載的'.zip'文件。在問題本身中解釋你想要的。 – kdbanman

+0

你爲什麼想這樣做?也許根據你期望的結果有不同的解決方案? – Abhishek

回答

1

嘗試通過殺死並像這樣運行它刷新Explorer.exe的

Option Explicit 
Dim ProcessName : ProcessName = "Explorer.exe" 
Refresh(ProcessName) 
'********************************************************************* 
Sub Refresh(ProcessName) 
Kill(ProcessName) 
RunIt(ProcessName) 
End Sub 
'********************************************************************* 
Sub Kill(ProcessName) 
Dim Ws : Set Ws = CreateObject("Wscript.Shell") 
Dim Command : Command = "Taskkill /F /IM "& ProcessName &"" 
Dim Result : Result = Ws.Run(Command,0,True) 
End Sub 
'********************************************************************* 
Sub RunIt(ProcessName) 
Dim Ws : Set Ws = CreateObject("Wscript.Shell") 
Dim Result : Result = Ws.Run(ProcessName,1,False) 
End Sub 
'*********************************************************************