From Newz, 1 Year ago, written in Visual Basic.
This paste is a reply to Re: VB Script Main 0101 0829 from Newz - view diff
Embed
  1. WScript.Sleep 3000
  2.  
  3. 'REMOVE 100% OF PINNED ITEMS AND ADD PINNED ITEMS:
  4.  
  5. 'Remove 100% Of Pinned Items:
  6. Set oShell = WScript.CreateObject ("WScript.Shell")
  7. oShell.run "cmd.exe /c copy ""C:\Users\User\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\Google Chrome.lnk"" ""C:\Users\User\Documents\Google Chrome.lnk"""
  8.  
  9. WScript.Sleep 4000
  10.  
  11. Set oShell = WScript.CreateObject ("WScript.Shell")
  12. oShell.run "cmd.exe /c del ""C:\Users\User\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Google Chrome.lnk"""
  13.  
  14. WScript.Sleep 4000
  15.  
  16. Set objShell = CreateObject("Shell.Application")
  17. Set objFolder = objShell.Namespace("C:\Users\User\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar")
  18.  
  19. For Each objFolderItem in objFolder.Items
  20.   For Each objVerb in objFolderItem.Verbs
  21.     If Replace(objVerb.name, "&", "") = "Unpin from Taskbar" Then objVerb.DoIt
  22.   Next
  23. Next
  24.  
  25. WScript.Sleep 4000
  26.  
  27. Set oShell = WScript.CreateObject ("WScript.Shell")
  28. oShell.run "cmd.exe /c copy ""C:\Users\User\Documents\Google Chrome.lnk"" ""C:\Users\User\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Google Chrome.lnk"""
  29.  
  30. WScript.Sleep 4000
  31.  
  32. 'Add Pinned Items:
  33. Set objShell = CreateObject("Shell.Application")
  34. Set oShell = CreateObject("WScript.Shell")
  35. Set ofso = CreateObject("Scripting.FileSystemObject")
  36.  
  37. strFile = "C:\Windows\System32\notepad.exe"
  38. PinToTaskBar
  39.  
  40. strFile = "C:\Windows\System32\cmd.exe"
  41. PinToTaskBar
  42.  
  43. strFile = "C:\Windows\explorer.exe"
  44. PinToTaskBar
  45.  
  46. sub PinToTaskBar
  47.  
  48. if ofso.fileexists(strFile) then
  49.    Set objFolder = objShell.Namespace(ofso.GetParentFolderName(strFile))
  50.    Set objFolderItem = objFolder.ParseName(ofso.GetFileName(strFile))
  51.    Set colVerbs = objFolderItem.Verbs
  52.    For Each objVerb in colVerbs
  53.       If Replace(objVerb.name, "&", "") = "Pin to Taskbar" Then objVerb.DoIt
  54.    Next
  55. End IF
  56.  
  57. End Sub
  58.  
  59. 'MAP FOLDERS TO SIDEBAR AS SUBSTITUTED DIRECTORIES:
  60. Set oShell = WScript.CreateObject ("WScript.Shell")
  61. oShell.run "cmd.exe /c subst V: C:\Users\User"
  62. Set oShell = WScript.CreateObject ("WScript.Shell")
  63. oShell.run "cmd.exe /c subst W: C:\Users\User\Documents"
  64. Set oShell = WScript.CreateObject ("WScript.Shell")
  65. oShell.run "cmd.exe /c subst X: C:\Users\User\Downloads"
  66. Set oShell = WScript.CreateObject ("WScript.Shell")
  67. oShell.run "cmd.exe /c subst Y: C:\"
  68.  
  69. WScript.Sleep 3000
  70.  
  71. 'Rename Drive Letters:
  72. Set oShell = WScript.CreateObject ("Shell.Application")
  73. oShell.NameSpace("V:\").Self.Name = "User (Home)"
  74. Set oShell = WScript.CreateObject ("Shell.Application")
  75. oShell.NameSpace("W:\").Self.Name = "Documents"
  76. Set oShell = WScript.CreateObject ("Shell.Application")
  77. oShell.NameSpace("X:\").Self.Name = "Downloads"
  78.  
  79. WScript.Sleep 3000
  80.  
  81. 'Special Code For Local Drive (C) (Mounted As Y:):
  82. Set oShell = WScript.CreateObject ("WScript.Shell")
  83. oShell.run "cmd.exe /c subst Y: C:\Users\User\Downloads"
  84.  
  85. Set oShell = WScript.CreateObject("Shell.Application")
  86. oShell.NameSpace("Y:\").Self.Name = "Local Drive (C)"
  87.  
  88. WScript.Sleep 3000
  89. WshShell.SendKeys "{ENTER}"
  90.  
  91. Set oShell = WScript.CreateObject ("WScript.Shell")
  92. oShell.run "cmd.exe /c subst /d Y:"
  93. Set oShell = WScript.CreateObject ("WScript.Shell")
  94. oShell.run "cmd.exe /c subst Y: C:\"
  95.  
  96. '- - -
  97.  
  98. WScript.Sleep 3000
  99.  
  100. 'UNPIN AND PIN PROGRAMS TO TASKBAR & KILL VARIOUS TASKS:
  101.  
  102. 'Pin Programs To Taskbar
  103. Set oShell = WScript.CreateObject ("WScript.Shell")
  104. Set wsc = WScript.CreateObject("WScript.Shell")
  105. Set lnk = wsc.CreateShortcut("C:\Users\User\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\Command Prompt.lnk")
  106. lnk.targetpath = "C:\Windows\System32\cmd.exe"
  107. lnk.workingdirectory = "C:\Windows\System32"
  108. lnk.save
  109.  
  110. WScript.Sleep 3000
  111.  
  112. 'Kill Various Tasks
  113.  
  114. '>>>>>>>>>SEARCH THROUGH TASKS TO FIND MORE TO KILL
  115.  
  116. '<<<<<<<<<Set oShell = WScript.CreateObject ("WScript.Shell")
  117. '<<<<<<<<<set result=oShell.run "cmd.exe /c taskkill /f /im tvnserver.exe > nul 2>&1" 'TightVNC Tray Icon
  118. '<<<<<<<<<result=msgbox()
  119.  
  120. Set oShell = WScript.CreateObject ("WScript.Shell")
  121. oShell.run "cmd.exe /c taskkill /f /im pntray.exe" 'Dell vWorkspace Tray Icon
  122. Set oShell = WScript.CreateObject ("WScript.Shell")
  123. oShell.run "cmd.exe /c taskkill /f /im rthdvcpl.exe" 'Realtek Semiconductor High Definition Audio Tray Icon
  124. Set oShell = WScript.CreateObject ("WScript.Shell")
  125. oShell.run "cmd.exe /c taskkill /f /im mom.exe" 'Part Of AMD ATI Catalyst Control Center
  126. Set oShell = WScript.CreateObject ("WScript.Shell")
  127. oShell.run "cmd.exe /c taskkill /f /im ccc.exe" 'AMD ATI Catalyst Control Center Tray Icon
  128.  
  129. WScript.Sleep 5000
  130.  
  131. '>>>>>>>>>POSSIBLY LOG SUCCESS OF TASKS KILLED
  132.  
  133. 'Relaunch "Explorer.exe":
  134. Set oShell = WScript.CreateObject ("WScript.Shell")
  135. oShell.run "cmd.exe /c taskkill /f /im explorer.exe"
  136.  
  137. WScript.Sleep 4000
  138.  
  139. Set oShell = WScript.CreateObject ("WScript.Shell")
  140. oShell.run "cmd.exe /c copy ""C:\Windows\System32\cmd.exe"" ""Z:\bbb.exe"""
  141.  
  142. WScript.Sleep 2000
  143.  
  144. Set oShell = WScript.CreateObject ("WScript.Shell")
  145. oShell.run "Z:\bbb.exe /c C:\Windows\explorer"
  146.  
  147. WScript.Sleep 4000
  148.  
  149. Set oShell = WScript.CreateObject ("WScript.Shell")
  150. oShell.run "cmd.exe /c taskkill /f /im bbb.exe"
  151.  
  152. '>>>>>>>>>DELETE ALL CONTENTS OF Z DRIVE
  153.  
  154. 'Set oShell = WScript.CreateObject ("WScript.Shell")
  155. 'oShell.run "cmd.exe /c copy Z:\Z.vbs C:\Users\User\Documents\Z.vbs"
  156.  
  157. 'Set oShell = WScript.CreateObject ("WScript.Shell")
  158. 'oShell.run "cmd.exe /c del /S Z:\*"
  159.  
  160.  
  161. '>>>>>>>>>UPDATE CHROME (FIRST QUIT WINDOWS EXPLORER TO FREE UP RAM)
  162.  
  163. '>>>>>>>>>INSTALL CHROME EXTENSIONS
  164.  
  165. '>>>>>>>>>"shutdown /a" SHORTCUT ON TASKBAR OR AUTO-DETECT AND CANCEL WHEN SYSTEM WARNS ABOUT SHUTTING DOWN TO FREE MEMORY
  166.  
  167. '>>>>>>>>>MAKE THIS SCRIPT RUN IN BACKGROUND INSTEAD OF ON-SCREEN cmd.exe WINDOWS:
  168.  
  169. 'END OF SCRIPT USER NOTIFICATION:
  170. msgbox("The Script Completed Successfully")
  171.  
  172. '- - -
  173.  
  174. 'https://msdn.microsoft.com/en-us/library/5h27x7e9(v=vs.84).aspx
  175. '(If Then Single Line Syntax)
  176.  
  177. 'http://stackoverflow.com/questions/157747/vbscript-using-error-handling
  178. '(Error Handling)
  179.  
  180. '- - -
  181.  
  182. 'Clear output.txt
  183. 'echo( > C:\Users\User\Documents\output.txt
  184.  
  185. 'Find only lines with files
  186. 'dir Z:\ >> C:\Users\User\Documents\output.txt & for /f "delims=" %a in ('findstr /c:"M " C:\Users\User\Documents\output.txt') do @set var=%a & echo( > C:\Users\User\Documents\output.txt & echo %a > C:\Users\User\Documents\output.txt
  187.  
  188. 'Output number of lines
  189. 'for /f "delims=" %a in ('find /v /c "" C:\Users\User\Documents\output.txt') do @set var=%a & @echo %var:~47%

Replies to VB Script Main 0101 1306 rss

Title Name Language When
VB Script Main 0101 17:38 Newz vb 1 Year ago.