用bat命令重启explorer的方法

xiaoxiao2021-02-28  118

下面文件保存为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 参考资料:http://www.bathome.net/thread-32834-1-1.html
转载请注明原文地址: https://www.6miu.com/read-75906.html

最新回复(0)