中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-03 22:25
48,038 topics / 350,123 posts / today 0 new / 48,251 members
DOS批处理 & 脚本技术(批处理室) » Enumerate/Delete Registry Run Items (User/SYSTem) → VBS Version
Printable Version  1,917 / 11
Floor1 baomaboy Posted 2007-03-23 06:27
银牌会员 Posts 554 Credits 1,513
Support batch input (2, 3, 5, 6)

http://zhenlove.com.cn/cndos/fileup/files/Manage_RegistryRoot.rar

The above is the install/uninstall file, which is installed by default in the right-click menu of "My Computer", as shown in the following figure





[ Last edited by baomaboy on 2007-3-23 at 11:59 AM ]
Floor2 baomaboy Posted 2007-03-23 06:31
银牌会员 Posts 554 Credits 1,513
Dim WshShell,FSO
On Error Resume Next
Set WshShell = WScript.CreateObject("WScript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
CloseTime = 5
FileName = WScript.ScriptName
FileFullName = WScript.ScriptFullName
FilePath = FSO.GetParentFolderName(FileFullName)
InsPath = FSO.GetSpecialFolder(1)
InsFullName = FSO.BuildPath(InsPath ,FileName)
Copyright="Linglong Technology"
QQ="QQ:25926183"
Email="Email:fty1995@163.com"
InsTitle="Manage Registry Startup Items"
InsAnswer="Manage Registry Startup Items"
RegPath1="HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\Manage_Registry\"
RegValue1="Manage Startup Items"
RegPath2="HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\Manage_Registry\command\"
RegValue2="wscript.exe "&InsFullName
IF FileFullName <> InsFullName then
intAnswer = MsgBox("【Yes】Add " & InsAnswer & " to the right-click menu of My Computer, " & Chr(10) & Chr(10) & "【No】Remove " & InsAnswer & " from the right-click menu of My Computer. ", vbQuestion + vbYesNoCancel, "Installation - " & InsTitle & " - " & Copyright)
If intAnswer = vbYes Then
FSO.GetFile(FileFullName).Copy(InsFullName)
WshSHell.RegWrite RegPath1,RegValue1
WshSHell.RegWrite RegPath2,RegValue2
WshShell.popup _
"Add script file: " & chr(10) & InsFullName & chr(10) & chr(10) & _
"Add registry entry: " & chr(10) & chr(34) & RegPath1 & chr(34) & chr(10) & _
chr(10) & CloseTime & " seconds later this window will close automatically! " & chr(10) & chr(10) & _
chr(10) & "Copyright(C) " & Copyright & " " & QQ & " " & Email _
, CloseTime, "Installation Successful - " & InsTitle & " - " & Copyright, 0 + 64
end if
If intAnswer = vbNo Then
FSO.DeleteFile InsFullName
WshSHell.RegDelete RegPath2
WshSHell.RegDelete RegPath1
WshShell.popup _
"Delete script file: " & chr(10) & InsFullName & chr(10) & chr(10) & _
"Delete registry entry: " & chr(10) & chr(34) & RegPath1 & chr(34) & chr(10) & _
chr(10) & CloseTime & " seconds later this window will close automatically! " & chr(10) & chr(10) & _
chr(10) & "Copyright(C) " & Copyright & " " & QQ & " " & Email _
, CloseTime, "Uninstallation Successful - " & InsTitle & " - " & Copyright, 0 + 64
end if
If intAnswer = vbCancel Then
end if
ELSE
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set StdOut = WScript.StdOut
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Run"
For r=1 to 2
if r=1 then
strKeyRoot=HKEY_CURRENT_USER:User="User"
else
strKeyRoot=HKEY_LOCAL_MACHINE:User="SYSTem"
end if
oReg.EnumValues strKeyRoot, strKeyPath, arrValueNames, arrValueTypes
CatchIt
next
End If
Set WshSHell = Nothing
Set FSO = Nothing
Set Args = Nothing
WScript.Quit(0)
Function CatchIt()
i=0
For Each strValue in arrValueNames
If Len(strValue) > 0 Then
i=i+1
oReg.GetStringValue strKeyRoot,strKeyPath,strValue,strRunCommand
intLength = Len(strRunCommand)
if intLength > 35 then'''Aesthetically display, (can add more code to judge whether the path contains broken Chinese characters)
strRunCommand = Left(strRunCommand, 20)&"……"&Right(strRunCommand, 13)
end if
StrRoot= i&".【"&strValue&"】"&vbCRLF&" "&strRunCommand
ARoot=ARoot&vbCRLF&StrRoot
End If
Next
DumpIt=InputBox("Please enter the serial number to delete: (" & User & " self-start items)" & vbCRLF & vbCRLF & ARoot,"Delete Self-Startup Items - " & QQ)
DumpIt=split(DumpIt,",")
for n=0 To UBound(DumpIt)
If IsNumeric(DumpIt(n))=True Then
DumpIt(n)=int(DumpIt(n))
i=int(i)
if DumpIt(n) < 1 or DumpIt(n) > i Then
WshShell.popup chr(10) &_
"Please enter the correct number value (note the number range)!" & chr(10) & chr(10) & _
chr(10) & CloseTime & " seconds later this window will close automatically! " & chr(10) & chr(10) & _
chr(10) & "Copyright(C) " & Copyright & " " & QQ & " " & Email _
, CloseTime, "Error Prompt - " & InsTitle & " - " & Copyright, 0 + 48
WScript.Quit(0)
else
oReg.DeleteValue strKeyRoot,strKeyPath,arrValueNames(DumpIt(n)-1)
end if
else
WshShell.popup chr(10) &_
"Please enter the correct number value (enter numeric value)!" & chr(10) & chr(10) & _
chr(10) & CloseTime & " seconds later this window will close automatically! " & chr(10) & chr(10) & _
chr(10) & "Copyright(C) " & Copyright & " " & QQ & " " & Email _
, CloseTime, "Error Prompt - " & InsTitle & " - " & Copyright, 0 + 48
WScript.Quit(0)
end if
next
end Function
 

[ Last edited by baomaboy on 2008-3-25 at 01:07 AM ]
Floor3 zh159 Posted 2007-03-23 06:47
金牌会员 Posts 1,467 Credits 3,687
Good stuff, saved it, saved the rabbit

There is one more line in 18 lines:
......
next
End If
WScript.Quit(0)
......
Floor4 baomaboy Posted 2007-03-23 06:58
银牌会员 Posts 554 Credits 1,513
Originally posted by zh159 at 2007-3-23 06:47:
Good stuff, collected, saved the rabbit

There is one more line in 18 lines:

Thanks to zh159 for adding points
The extra line is for implementing the install/uninstall function. When pasting the code, only the core part of the code was copied, and the extra line was not noticed and forgotten to be deleted.
Floor5 wang6610 Posted 2007-03-23 08:09
银牌会员 Posts 488 Credits 1,246
Originally posted by baomaboy at 2007-3-23 06:58 AM:

Thanks zh159 for adding points
The extra sentence is for implementing the install/uninstall function. When pasting the code, only the core part of the code was copied, and the extra sentence was not noticed and forgotten to be deleted.



Please post a complete one. I'm not familiar with vbs, thanks.
Floor6 electronixtar Posted 2007-03-23 08:15
铂金会员 Posts 2,672 Credits 7,493
A small suggestion: Enclose the code with [code] [/code] for a more beautiful appearance, heh heh
Floor7 baomaboy Posted 2007-03-23 10:11
银牌会员 Posts 554 Credits 1,513
Originally posted by wang6610 at 2007-3-23 08:09:

Please post a complete one. I'm not familiar with vbs, thanks.



The complete code can be downloaded on the first floor!
Floor8 baomaboy Posted 2007-03-23 10:17
银牌会员 Posts 554 Credits 1,513
[quote]Originally posted by [i]electronixtar[/i] at 2007-3-23 08:15:
A small suggestion: Wrapping code with [code] [/code] makes it more beautiful, heh heh
[/quote]


If it weren't for your reminder, I wouldn't have known to use "[code] [/code]" heh heh

[[i] Last edited by baomaboy on 2007-3-23 at 10:19 AM [/i]]
Floor9 electronixtar Posted 2007-03-23 12:38
铂金会员 Posts 2,672 Credits 7,493
This is it:

WScript.Echo "Hello, world!'



Almost universal in almost all forums

[ Last edited by electronixtar on 2007-3-23 at 12:39 PM ]
Floor10 zh159 Posted 2007-03-23 12:45
金牌会员 Posts 1,467 Credits 3,687
Originally posted by electronixtar at 2007-3-22 19:15:
A small suggestion: It's more beautiful to enclose code with , heh heh

That is, the icon of

Preparing to study and convert it to HTA for use

Recently started playing with HTA and found it easy to use. The interface is better than pure VBS (some components are not as good as the direct IE interface: such as buttons, radio buttons, checkboxes, etc.)
Floor11 kich Posted 2007-03-24 09:14
中级用户 Posts 168 Credits 397
How great it is not to be encrypted! Like! Like!
Floor12 baomaboy Posted 2007-03-24 12:33
银牌会员 Posts 554 Credits 1,513
Originally posted by kich at 2007-3-24 09:14:
How nice it is without encryption! Thumbs up! Thumbs up!

It's not for encryption for the sake of encryption. Isn't this also a usage of VBS? Moreover, VBS encryption is just a smokescreen...
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023