本帖最后由 yu2n 于 2015-5-6 22:16 编辑
回复 9# 867258173
回复 yu2n
可以用 explore 方法:
CrLf 发表于 2014-11-7 20:43
谢谢提醒。BAT版如下。- @echo off
- title 重启 Explorer 示例程序
- set/p "p=即将重启 Explorer,"<nul & pause
-
- Call :_RestartExplorer
- echo 完成!
- pause
-
- :: 重启 Explorer
- goto :eof
- :_RestartExplorer
- (
- echo Dim arrURL^(^), strURL, oShell, oWin, n
- echo n = -1
- echo Set oShell = CreateObject^("Shell.Application"^)
- echo For Each oWin In oShell.Windows
- echo If Instr^(1, oWin.FullName, "\explorer.exe", vbTextCompare^) Then
- echo n = n + 1
- echo ReDim Preserve arrURL^(n^)
- echo arrURL^(n^) = oWin.LocationURL
- echo End If
- echo Next
- echo CreateObject^("WScript.Shell"^).run "tskill explorer", 0, True
- echo For Each strURL In arrURL
- echo oShell.Explore strURL
- echo Next
- )>"%temp%\RestartExplorer.vbs"
- CScript //NoLogo "%temp%\RestartExplorer.vbs"
- del /q /f "%temp%\RestartExplorer.vbs"
- goto :eof
复制代码
|