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

Replies to Re: VB Script Main 0101 0829 rss

Title Name Language When
VB Script Main 0101 1306 Newz vb 1 Year ago.