[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
  1. Dim WshSHell,FSO
  2. On Error Resume Next
  3. Set WshSHell = WScript.CreateObject("WScript.Shell")
  4. Set FSO = CreateObject("Scripting.FileSystemObject")
  5. Set WinVer = WshSHell.Environment("Process")
  6. Set Args = WScript.Arguments
  7. CloseTime = 5
  8. FileName = WScript.ScriptName
  9. FileFullName = WScript.ScriptFullName
  10. FilePath = FSO.GetParentFolderName(FileFullName)
  11. InsPath = FSO.GetSpecialFolder(1)
  12. InsFullName = FSO.BuildPath(InsPath ,FileName)
  13. LnkPathNT = WshSHell.SpecialFolders(2)
  14. LnkPath9X = WshSHell.SpecialFolders(14)
  15. LnkPathAll = WshSHell.SpecialFolders("StartMenu")
  16. OtherFileName="winclip.exe"
  17. OtherFilePath=FSO.GetSpecialFolder(1)
  18. TemFileName="无标题"
  19. TemFilePath=FSO.GetSpecialFolder(2)
  20. Copyright="ChnhkSoft"
  21. QQ="QQ:191035066"
  22. Email="Email:ChnhkSoft@qq.com"
  23. InsTitle="复制路径到剪贴板-Winclip版"
  24. InsAnswer="复制路径到剪贴板"
  25. RegPath1="HKEY_CLASSES_ROOT\*\shell\PathCopyEx_Winclip\"
  26. RegValue1="复制路径到剪贴板"
  27. RegForm1="REG_SZ"
  28. RegPath2="HKEY_CLASSES_ROOT\*\shell\PathCopyEx_Winclip\command\"
  29. RegValue2="wscript.exe " & chr(34) & InsFullName & chr(34) & " " & chr(34) & "%L" & chr(34)
  30. RegForm2="REG_SZ"
  31. RegPath3="HKEY_CLASSES_ROOT\Directory\shell\PathCopyEx_Winclip\"
  32. RegValue3="复制路径到剪贴板"
  33. RegForm3="REG_SZ"
  34. RegPath4="HKEY_CLASSES_ROOT\Directory\shell\PathCopyEx_Winclip\command\"
  35. RegValue4="wscript.exe " & chr(34) & InsFullName & chr(34) & " " & chr(34) & "%L" & chr(34)
  36. RegForm4="REG_SZ"
  37. RegPath9="HKEY_CLASSES_ROOT\Drive\shell\"
  38. RegPath10="HKEY_CLASSES_ROOT\Directory\shell\"
  39. RegValue13="open"
  40. WshSHell.RegWrite RegPath9,RegValue13,RegForm1
  41. WshSHell.RegWrite RegPath10,RegValue13,RegForm1
  42. IF FileFullName <> InsFullName then
  43. intAnswer = MsgBox("【是】将“"+ InsAnswer +"”加入到右键菜单,"&Chr(10)&Chr(10)&"【否】将“"+ InsAnswer +"”从右键菜单删除。 ", vbQuestion + vbYesNoCancel, "安装 - "+ InsTitle +" - "+ Copyright)
  44.     If intAnswer = vbYes Then
  45. WshSHell.RegWrite RegPath1,RegValue1,RegForm1
  46. WshSHell.RegWrite RegPath2,RegValue2,RegForm2
  47. WshSHell.RegWrite RegPath3,RegValue3,RegForm3
  48. WshSHell.RegWrite RegPath4,RegValue4,RegForm4
  49. FSO.GetFile(FileFullName).Copy(InsFullName)
  50. If (FSO.FileExists(FSO.BuildPath(FilePath,"winclip.llkj"))) Then
  51. FSO.GetFile(FSO.BuildPath(FilePath,"winclip.llkj")).Copy(FSO.BuildPath(OtherFilePath,OtherFileName))
  52. else
  53. Call alltovbs
  54. end if
  55. FSO.GetFile(FSO.BuildPath(FilePath,"winclip.llkj")).Copy(FSO.BuildPath(OtherFilePath,OtherFileName))
  56. WshSHell.popup _
  57. "添加脚本文件:"+chr(10)+InsFullName+chr(10)+chr(10)+ _
  58. "添加执行文件:"+chr(10)+FSO.BuildPath(OtherFilePath,OtherFileName)+chr(10)+chr(10)+ _
  59. "添加注册表项:"+chr(10)+chr(34)+ RegPath1 +chr(34)+chr(10)+chr(34)+ RegPath3 +chr(34)+chr(10) & _
  60. chr(10) & CloseTime & " 秒钟后本窗口将自动关闭!" +chr(10)+chr(10)+ _
  61. chr(10) & "Copyright(C)  " + Copyright +"   " & QQ &"   " + Email _
  62. , CloseTime, "安装成功 - "+ InsTitle +" - "+ Copyright, 0 + 64
  63. end if
  64.         If intAnswer = vbNo Then
  65. WshSHell.RegDelete RegPath4
  66. WshSHell.RegDelete RegPath3
  67. WshSHell.RegDelete RegPath2
  68. WshSHell.RegDelete RegPath1
  69. FSO.DeleteFile InsFullName
  70. FSO.DeleteFile FSO.BuildPath(OtherFilePath,OtherFileName)
  71. WshSHell.popup _
  72. "删除脚本文件:"+chr(10)+InsFullName+chr(10)+chr(10)+ _
  73. "删除执行文件:"+chr(10)+FSO.BuildPath(OtherFilePath,OtherFileName)+chr(10)+chr(10)+ _
  74. "删除注册表项:"+chr(10)+chr(34)+ RegPath1 +chr(34)+chr(10)+chr(34)+ RegPath3 +chr(34)+chr(10) & _
  75. chr(10) & CloseTime & " 秒钟后本窗口将自动关闭!" +chr(10)+chr(10)+ _
  76. chr(10) & "Copyright(C)  " + Copyright +"   " & QQ &"   " + Email _
  77. , CloseTime, "卸载成功 - "+ InsTitle +" - "+ Copyright, 0 + 64
  78. end if
  79.         If intAnswer = vbCancel Then
  80. end if
  81. ELSE
  82. If (FSO.FileExists(FSO.BuildPath(OtherFilePath,OtherFileName))) Then
  83. Set TempFile = FSO.CreateTextFile(FSO.BuildPath(TemFilePath ,TemFileName), True)
  84. TempFile.WriteLine(Args(0))
  85. TempFile.Close
  86. WshSHell.Run (FSO.BuildPath(OtherFilePath,OtherFileName) & " -c " & FSO.BuildPath(TemFilePath ,TemFileName)), vbHide
  87. else
  88. WshSHell.popup +chr(10)+ _
  89. "操作失败了!" +chr(10)+chr(10)+ _
  90. "您的系统丢失文件 “Winclip.exe” ,因此您的操作请求未能成功。" + chr(10)+chr(10)+ _
  91. "对此我们感到非常抱歉,重新执行安装程序可能会解决此问题。" + _
  92. chr(10)+chr(10) & CloseTime & " 秒后本窗口自动关闭!" +chr(10)+chr(10)+ _
  93. chr(10) & "Copyright(C)  " + Copyright +"   " & QQ &"   " + Email _
  94. , CloseTime, "操作失败 - "+ InsTitle +" - "+ Copyright, 0 + 48
  95. End If
  96. End IF
  97. Set WshSHell = Nothing
  98. Set FSO = Nothing
  99. Set Args = Nothing
  100. WScript.Quit(0)
  101. sub alltovbs()
  102. '自生成Winclip.exe
  103. end sub
复制代码

TOP

返回列表