![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-08-04 04:18 |
48,038 topics / 350,123 posts / today 0 new / 48,251 members |
| DOS批处理 & 脚本技术(批处理室) » Copy path to clipboard → VBS version |
| Printable Version 2,973 / 15 |
| Floor16 baomaboy | Posted 2007-04-13 14:02 |
| 银牌会员 Posts 554 Credits 1,513 | |
|
```
Dim WshSHell,FSO On Error Resume Next Set WshSHell = WScript.CreateObject("WScript.Shell") Set FSO = CreateObject("Scripting.FileSystemObject") Set WinVer = WshSHell.Environment("Process") Set Args = WScript.Arguments CloseTime = 5 FileName = WScript.ScriptName FileFullName = WScript.ScriptFullName FilePath = FSO.GetParentFolderName(FileFullName) InsPath = FSO.GetSpecialFolder(1) InsFullName = FSO.BuildPath(InsPath ,FileName) LnkPathNT = WshSHell.SpecialFolders(2) LnkPath9X = WshSHell.SpecialFolders(14) LnkPathAll = WshSHell.SpecialFolders("StartMenu") OtherFileName="PathCopyEx.dll" OtherFilePath=FSO.GetSpecialFolder(1) TemFileName = "PathCopyEx.reg" TemFilePath = FSO.GetSpecialFolder(1) Copyright="Linglong Technology" QQ="QQ:25926183" Email="Email:fty1995@163.com" InsTitle="Copy Path to Clipboard - DLL Version" InsAnswer="Copy Path to Clipboard" RegPath1="HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\PathCopyMenu\" RegPath2="HKEY_CLASSES_ROOT\Directory\shellex\ContextMenuHandlers\PathCopyMenu\" IF FileFullName <> InsFullName then intAnswer = MsgBox("【Yes】Add “"+ InsAnswer +"” to the right - click menu,"&Chr(10)&Chr(10)&"【No】Remove “"+ InsAnswer +"” from the right - click menu. ", vbQuestion + vbYesNoCancel, "Installation - "+ InsTitle +" - "+ Copyright) If intAnswer = vbYes Then If (FSO.FileExists(FSO.BuildPath(OtherFilePath,OtherFileName))) Then WshSHell.Run ("regsvr32 /s " & FSO.BuildPath(OtherFilePath,OtherFileName)), vbHide Else If (FSO.FileExists(FSO.BuildPath(FilePath,"PathCopyEx.llkj"))) Then FSO.GetFile(FSO.BuildPath(FilePath,"PathCopyEx.llkj")).Copy(FSO.BuildPath(OtherFilePath,OtherFileName)) else Call alltovbs end if WScript.Sleep 2000 WshSHell.Run ("regsvr32 /s " & FSO.BuildPath(OtherFilePath,OtherFileName)), vbHide end if WshSHell.popup _ "Add dynamic link:"+chr(10)+FSO.BuildPath(OtherFilePath,OtherFileName)+chr(10)+chr(10)+ _ "Add registry entries:"+chr(10)+chr(34)+ RegPath1 +chr(34)+chr(10)+chr(34)+ RegPath2 +chr(34)+chr(10) & _ chr(10) & CloseTime & " seconds later this window will close automatically!" +chr(10)+chr(10)+ _ chr(10) & "Copyright(C) " + Copyright +" " & QQ &" " + Email _ , CloseTime, "Installation Successful - "+ InsTitle +" - "+ Copyright, 0 + 64 end if If intAnswer = vbNo Then WshSHell.Run ("regsvr32 /u /s " & FSO.BuildPath(OtherFilePath,OtherFileName)), vbHide FSO.DeleteFile FSO.BuildPath(OtherFilePath,OtherFileName) If (FSO.FileExists(FSO.BuildPath(OtherFilePath,OtherFileName))) Then WshSHell.popup +chr(10)+ _ "The library file "&FSO.BuildPath(OtherFilePath,OtherFileName)&" is occupied by the system," + chr(10)+chr(10)+ _ "Now try to restart Explorer and then delete it." + _ chr(10)+chr(10) & CloseTime & " seconds later this window will close automatically!" +chr(10)+chr(10)+ _ chr(10) & "Copyright(C) " + Copyright +" " & QQ &" " + Email _ , CloseTime, "Uninstallation Process - "+ InsTitle +" - "+ Copyright, 0 + 64 If WinVer("OS") <> "Windows_NT" Then WshSHell.Run ("RUNDLL32 SHELL32.DLL,SHExitWindowsEx -1"), vbHide WScript.Sleep 3000 FSO.DeleteFile FSO.BuildPath(OtherFilePath,OtherFileName) If (FSO.FileExists(FSO.BuildPath(OtherFilePath,OtherFileName))) Then''If the explorer is still refused to delete after restart, write to Wininit.ini to delete next time, used for winme if (FSO.FileExists(FSO.BuildPath(FSO.GetSpecialFolder(0) ,"Wininit.ini"))) Then Set OldFile = FSO.OpenTextFile(FSO.BuildPath(FSO.GetSpecialFolder(0) ,"Wininit.ini"), 8, True) OldFile.WriteLine("") OldFile.WriteLine("nul="&FSO.BuildPath(OtherFilePath,FSo.GetFile(FSO.BuildPath(OtherFilePath,OtherFileName)).ShortName)) OldFile.Close else Set NewFile = FSO.CreateTextFile(FSO.GetSpecialFolder(0) &"\Wininit.ini", True) NewFile.WriteLine("") NewFile.WriteLine("") NewFile.WriteLine("nul="&FSO.BuildPath(OtherFilePath,FSo.GetFile(FSO.BuildPath(OtherFilePath,OtherFileName)).ShortName)) NewFile.Close end if if (FSO.FileExists(FSO.BuildPath(FSO.GetSpecialFolder(0) ,"winstart.bat"))) Then''If the explorer is still refused to delete after restart, write to winstart.bat to delete next time, used for win98 Set OldFile = FSO.OpenTextFile(FSO.BuildPath(FSO.GetSpecialFolder(0) ,"winstart.bat"), 8, True) OldFile.WriteLine("") OldFile.WriteLine("deltree /y "&FSO.BuildPath(OtherFilePath,FSo.GetFile(FSO.BuildPath(OtherFilePath,OtherFileName)).ShortName)) OldFile.WriteLine("@ del %0") OldFile.Close else Set NewFile = FSO.CreateTextFile(FSO.GetSpecialFolder(0) &"\winstart.bat", True) NewFile.WriteLine("@echo off") NewFile.WriteLine("") NewFile.WriteLine("deltree /y "&FSO.BuildPath(OtherFilePath,FSo.GetFile(FSO.BuildPath(OtherFilePath,OtherFileName)).ShortName)) NewFile.WriteLine("@ del %0") NewFile.Close end if else Call delok end if else For Each Process in GetObject("winmgmts:"). _ ExecQuery ("select * from Win32_Process where name='explorer.exe'") Process.terminate(0) Next WScript.Sleep 3000 FSO.DeleteFile FSO.BuildPath(OtherFilePath,OtherFileName) WScript.Sleep 3000 for each ps in getobject _ ("winmgmts:\\.\root\cimv2:win32_process").instances_ if LCase(ps.name)="explorer.exe" then expl="yes" exit for else expl="no" end if next if expl="no" then WshSHell.Run ("explorer.exe") end if If (FSO.FileExists(FSO.BuildPath(OtherFilePath,OtherFileName))) Then''If the explorer is still refused to delete after restart, write to the registry to delete next time, used for winxp Set NewRegFile = FSO.CreateTextFile(FSO.BuildPath(TemFilePath ,TemFileName), True) NewRegFile.WriteLine("Windows Registry Editor Version 5.00") NewRegFile.WriteLine("") NewRegFile.WriteLine("") NewRegFile.WriteLine(chr(34)&"PendingFileRenameOperations"&chr(34)&"=hex(7):5c,00,3f,00,3f,00,5c,00,43,00,3a,00,5c,00,\") NewRegFile.WriteLine(" 57,00,49,00,4e,00,44,00,4f,00,57,00,53,00,5c,00,73,00,79,00,73,00,74,00,65,\") NewRegFile.WriteLine(" 00,6d,00,33,00,32,00,5c,00,50,00,61,00,74,00,68,00,43,00,6f,00,70,00,79,00,\") NewRegFile.WriteLine(" 45,00,78,00,2e,00,64,00,6c,00,6c,00,00,00,00,00") NewRegFile.Close''Can create multi - string values with WMI WshSHell.Run ("regedit.exe /s "&FSO.BuildPath(TemFilePath ,TemFileName)), vbHide else Call delok end if end if If (FSO.FileExists(FSO.BuildPath(OtherFilePath,OtherFileName))) Then WshSHell.popup +chr(10)+ _ "The library file "&FSO.BuildPath(OtherFilePath,OtherFileName)&" is occupied by the system," + chr(10)+chr(10)+ _ "Can only be deleted after the system restarts." + _ chr(10)+chr(10) & CloseTime & " seconds later this window will close automatically!" +chr(10)+chr(10)+ _ chr(10) & "Copyright(C) " + Copyright +" " & QQ &" " + Email _ , CloseTime, "Uninstallation Successful - "+ InsTitle +" - "+ Copyright, 0 + 64 end if Else Call delok end if End If If intAnswer = vbCancel Then end if End IF Set WshSHell = Nothing Set FSO = Nothing Set Args = Nothing WScript.Quit(0) Sub delok() WshSHell.popup _ "Delete dynamic link:"+chr(10)+FSO.BuildPath(OtherFilePath,OtherFileName)+chr(10)+chr(10)+ _ "Delete registry entries:"+chr(10)+chr(34)+ RegPath1 +chr(34)+chr(10)+chr(34)+ RegPath2 +chr(34)+chr(10) & chr(10) + _ chr(10)+chr(10) & CloseTime & " seconds later this window will close automatically!" +chr(10)+chr(10)+ _ chr(10) & "Copyright(C) " + Copyright +" " & QQ &" " + Email _ , CloseTime, "Uninstallation Successful - "+ InsTitle +" - "+ Copyright, 0 + 64 End Sub sub alltovbs() 'Generate PathCopyEx.Dll by yourself end sub ``` |
|
| Prev 1 2 |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |