From Newz, 1 Year ago, written in Visual Basic.
This paste is a reply to VB Script Main 0101 0750 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 5000
  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 5000
  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 5000
  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 5000
  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 T: ""C:\Users\User\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch"""
  62. Set oShell = WScript.CreateObject ("WScript.Shell")
  63. oShell.run "cmd.exe /c subst U: ""C:\Users\User\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\Taskbar"""
  64. Set oShell = WScript.CreateObject ("WScript.Shell")
  65. oShell.run "cmd.exe /c subst V: C:\Users\User"
  66. Set oShell = WScript.CreateObject ("WScript.Shell")
  67. oShell.run "cmd.exe /c subst W: C:\Users\User\Documents"
  68. Set oShell = WScript.CreateObject ("WScript.Shell")
  69. oShell.run "cmd.exe /c subst X: C:\Users\User\Downloads"
  70. Set oShell = WScript.CreateObject ("WScript.Shell")
  71. oShell.run "cmd.exe /c subst Y: C:\"
  72.  
  73. WScript.Sleep 3000
  74.  
  75. 'Rename Drive Letters:
  76. Set oShell = WScript.CreateObject("Shell.Application")
  77. oShell.NameSpace("T:\").Self.Name = "System Pinned"
  78.  
  79. Set oShell = WScript.CreateObject ("Shell.Application")
  80. oShell.NameSpace("U:\").Self.Name = "User Pinned"
  81. Set oShell = WScript.CreateObject ("Shell.Application")
  82. oShell.NameSpace("V:\").Self.Name = "User (Home)"
  83. Set oShell = WScript.CreateObject ("Shell.Application")
  84. oShell.NameSpace("W:\").Self.Name = "Documents"
  85. Set oShell = WScript.CreateObject ("Shell.Application")
  86. oShell.NameSpace("X:\").Self.Name = "Downloads"
  87.  
  88. WScript.Sleep 3000
  89.  
  90. 'Special Code For Local Drive (C) (Mounted As Y:):
  91. Set oShell = WScript.CreateObject ("WScript.Shell")
  92. oShell.run "cmd.exe /c subst Y: C:\Users\User\Downloads"
  93.  
  94. 'Set oShell = WScript.CreateObject("Shell.Application")
  95. 'oShell.NameSpace("Y:\").Self.Name = "Local Drive (C)"
  96.  
  97. Set oShell = WScript.CreateObject ("WScript.Shell")
  98. oShell.run "cmd.exe /c subst /d Y:"
  99. Set oShell = WScript.CreateObject ("WScript.Shell")
  100. oShell.run "cmd.exe /c subst Y: C:\"
  101.  
  102. '- - -
  103.  
  104. WScript.Sleep 3000
  105.  
  106. 'UNPIN AND PIN PROGRAMS TO TASKBAR & KILL VARIOUS TASKS:
  107.  
  108. 'Pin Programs To Taskbar
  109. Set oShell = WScript.CreateObject ("WScript.Shell")
  110. Set wsc = WScript.CreateObject("WScript.Shell")
  111. Set lnk = wsc.CreateShortcut("C:\Users\User\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\Command Prompt.lnk")
  112. lnk.targetpath = "C:\Windows\System32\cmd.exe"
  113. lnk.workingdirectory = "C:\Windows\System32"
  114. lnk.save
  115.  
  116. WScript.Sleep 3000
  117.  
  118. 'Kill Various Tasks
  119.  
  120. '>>>>>>>>>SEARCH THROUGH TASKS TO FIND MORE TO KILL
  121.  
  122. Set oShell = WScript.CreateObject ("WScript.Shell")
  123. oShell.run "cmd.exe /c taskkill /f /im tvnserver.exe > nul 2>&1" 'TightVNC Tray Icon
  124. Set oShell = WScript.CreateObject ("WScript.Shell")
  125. oShell.run "cmd.exe /c taskkill /f /im pntray.exe" 'Dell vWorkspace Tray Icon
  126. Set oShell = WScript.CreateObject ("WScript.Shell")
  127. oShell.run "cmd.exe /c taskkill /f /im rthdvcpl.exe" 'Realtek Semiconductor High Definition Audio Tray Icon
  128. Set oShell = WScript.CreateObject ("WScript.Shell")
  129. oShell.run "cmd.exe /c taskkill /f /im mom.exe" 'Part Of AMD ATI Catalyst Control Center
  130. Set oShell = WScript.CreateObject ("WScript.Shell")
  131. oShell.run "cmd.exe /c taskkill /f /im ccc.exe" 'AMD ATI Catalyst Control Center Tray Icon
  132.  
  133. WScript.Sleep 7000
  134.  
  135. '>>>>>>>>>POSSIBLY LOG SUCCESS OF TASKS KILLED
  136.  
  137. 'Relaunch "Explorer.exe":
  138. Set oShell = WScript.CreateObject ("WScript.Shell")
  139. oShell.run "cmd.exe /c taskkill /f /im explorer.exe"
  140.  
  141. WScript.Sleep 5000
  142.  
  143. Set oShell = WScript.CreateObject ("WScript.Shell")
  144. oShell.run "cmd.exe /c copy ""C:\Windows\System32\cmd.exe"" ""Z:\bbb.exe"""
  145.  
  146. WScript.Sleep 2000
  147.  
  148. Set oShell = WScript.CreateObject ("WScript.Shell")
  149. oShell.run "Z:\bbb.exe /c C:\Windows\explorer"
  150.  
  151. WScript.Sleep 5000
  152.  
  153. Set oShell = WScript.CreateObject ("WScript.Shell")
  154. oShell.run "cmd.exe /c taskkill /f /im bbb.exe"
  155.  
  156. '>>>>>>>>>DELETE ALL CONTENTS OF Z DRIVE
  157.  
  158. 'Set oShell = WScript.CreateObject ("WScript.Shell")
  159. 'oShell.run "cmd.exe /c copy Z:\Z.vbs C:\Users\User\Documents\Z.vbs"
  160.  
  161. 'Set oShell = WScript.CreateObject ("WScript.Shell")
  162. 'oShell.run "cmd.exe /c del /S Z:\*"
  163.  
  164.  
  165. '>>>>>>>>>UPDATE CHROME (FIRST QUIT WINDOWS EXPLORER TO FREE UP RAM)
  166.  
  167. '>>>>>>>>>INSTALL CHROME EXTENSIONS
  168.  
  169.  
  170. '- - -
  171.  
  172. 'https://msdn.microsoft.com/en-us/library/5h27x7e9(v=vs.84).aspx
  173. '(If Then Single Line Syntax)
  174.  
  175. 'http://stackoverflow.com/questions/157747/vbscript-using-error-handling
  176. '(Error Handling)
  177.  
  178. '- - -
  179.  
  180. 'Clear output.txt
  181. 'echo( > C:\Users\User\Documents\output.txt
  182.  
  183. 'Find only lines with files
  184. '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
  185.  
  186. 'Output number of lines
  187. '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 0801 rss

Title Name Language When
Re: VB Script Main 0101 0829 Newz vb 1 Year ago.