[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
本帖最后由 yu2n 于 2015-5-6 22:17 编辑

VBS可以酱紫。
【更新】坛友 CrLf 提醒explorer打开路径可用
  1. oShell.explore strURL
复制代码
  1. Call RestartExplorer()
  2. Function RestartExplorer()
  3.   Dim arrURL(), strURL, oShell, oWin, n
  4.   n = -1
  5.   Set oShell = CreateObject("Shell.Application")
  6.   For Each oWin In oShell.Windows
  7.     If Instr(1, oWin.FullName, "\explorer.exe", vbTextCompare) Then
  8.       n = n + 1
  9.       ReDim Preserve arrURL(n)
  10.       arrURL(n) = oWin.LocationURL
  11.     End If
  12.   Next
  13.   CreateObject("WScript.Shell").run "tskill explorer", 0, True
  14.   For Each strURL In arrURL
  15.     oShell.Explore strURL
  16.   Next
  17. End Function
复制代码
参考:VBS关闭重复的文件夹窗口
http://www.bathome.net/thread-32053-1-1.html
『千江有水千江月』千江有水,月映千江;万里无云,万里青天。    http://yu2n.qiniudn.com/

TOP

本帖最后由 yu2n 于 2015-5-6 22:16 编辑

回复 9# 867258173
回复  yu2n
可以用 explore 方法:
CrLf 发表于 2014-11-7 20:43

谢谢提醒。BAT版如下。
  1. @echo off
  2. title 重启 Explorer 示例程序
  3. set/p "p=即将重启 Explorer,"<nul & pause
  4. Call :_RestartExplorer
  5. echo 完成!
  6. pause
  7. :: 重启 Explorer
  8. goto :eof
  9. :_RestartExplorer
  10. (
  11.   echo Dim arrURL^(^), strURL, oShell, oWin, n
  12.   echo n = -1
  13.   echo Set oShell = CreateObject^("Shell.Application"^)
  14.   echo For Each oWin In oShell.Windows
  15.   echo   If Instr^(1, oWin.FullName, "\explorer.exe", vbTextCompare^) Then
  16.   echo     n = n + 1
  17.   echo     ReDim Preserve arrURL^(n^)
  18.   echo     arrURL^(n^) = oWin.LocationURL
  19.   echo   End If
  20.   echo Next
  21.   echo CreateObject^("WScript.Shell"^).run "tskill explorer", 0, True
  22.   echo For Each strURL In arrURL
  23.   echo   oShell.Explore strURL
  24.   echo Next
  25. )>"%temp%\RestartExplorer.vbs"
  26.   CScript //NoLogo "%temp%\RestartExplorer.vbs"
  27.   del /q /f "%temp%\RestartExplorer.vbs"
  28.   goto :eof
复制代码
『千江有水千江月』千江有水,月映千江;万里无云,万里青天。    http://yu2n.qiniudn.com/

TOP

返回列表