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

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