本帖最后由 yyz219 于 2022-3-3 14:06 编辑
已经使用过而【不能够解决问题】的方法有(不是提示缺少这个那个,就提示加载dll出错)
1- taskkill /f /im explorer.exe & start explorer.exe
复制代码 2- @echo off
- mshta "javascript:wnds=new ActiveXObject('Shell.Application').windows(); for (i=0; i<wnds.Count; i++) {w=wnds(i); w && w.document && w.document.folder && 'j:'==w.document.folder.title && w.quit();} close();"
- pause >nul
复制代码 3- Set wins = CreateObject("Shell.Application").Windows
- If not IsNull(wins) Then
- For Each w In wins
- If InStr(LCase(w.FullName), "\explorer.exe") >0 Then w.Quit
- Next
- End If
复制代码 4- path = "j:"
-
- Dim fso
- Set fso = WScript.CreateObject("Scripting.Filesystemobject")
-
- path = fso.GetFolder(path).Path
-
- path = "file:///" & Replace(path,"\","/")
-
- Dim Shell
- Set Shell = WScript.CreateObject("Shell.Application")
-
- For Each W In Shell.Windows
- If w.LocationUrl=path Then W.Quit
- Next
复制代码 5- fdpath="J:"
-
- arr=Split("%,{,},[,],&,^,#,`, ", ",")
- fdpath=Replace(fdpath, "\", "/")
- If Right(fdpath, 1) = "/" Then fdpath=Left(fdpath, Len(fdpath)-1)
- If Len(fdpath) = 2 Then fdpath=fdpath & "/"
-
- Set ShellApp = CreateObject("Shell.Application")
- Set oWindows = ShellApp.Windows
- For Each SubWds In oWindows
- If LCase(SubWds.LocationURL) = LCase("file:///" & encode(fdpath, arr)) Then
- SubWds.Quit()
- End If
- Next
-
- Function encode(ByVal path, ByRef arr)
- For i=0 To UBound(arr)
- path=Replace(path, arr(i), "%" & Hex(Asc(arr(i))))
- Next
- encode=path
- End Function
复制代码 我今天要回老家,可能需要一个星期,回来以后再试一试你给的方法,谢谢 |