China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-03 23:27
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Enumerate/Delete Registry Run Items (User/SYSTem) → VBS Version View 1,918 Replies 11
Original Poster Posted 2007-03-23 06:27 ·  中国 河北 保定 联通
银牌会员
★★★
Credits 1,513
Posts 554
Joined 2005-12-30 00:50
20-year member
UID 48180
Gender Male
Status Offline
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 ]
Floor 2 Posted 2007-03-23 06:31 ·  中国 河北 保定 联通
银牌会员
★★★
Credits 1,513
Posts 554
Joined 2005-12-30 00:50
20-year member
UID 48180
Gender Male
Status Offline
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 ]
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
zh159 +15 2007-03-23 06:47
Floor 3 Posted 2007-03-23 06:47 ·  中国 广西 玉林 博白县 电信
金牌会员
★★★★
Credits 3,687
Posts 1,467
Joined 2005-08-08 12:00
20-year member
UID 44210
Status Offline
Good stuff, saved it, saved the rabbit

There is one more line in 18 lines:
......
next
End If
WScript.Quit(0)
......
Floor 4 Posted 2007-03-23 06:58 ·  中国 河北 保定 联通
银牌会员
★★★
Credits 1,513
Posts 554
Joined 2005-12-30 00:50
20-year member
UID 48180
Gender Male
Status Offline
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.
Floor 5 Posted 2007-03-23 08:09 ·  中国 山东 菏泽 联通
银牌会员
★★★
Credits 1,246
Posts 488
Joined 2003-11-11 00:00
22-year member
UID 12699
Gender Male
Status Offline
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.
Floor 6 Posted 2007-03-23 08:15 ·  中国 四川 成都 教育网
铂金会员
★★★★
Credits 7,493
Posts 2,672
Joined 2005-09-02 00:00
20-year member
UID 42173
Gender Male
Status Offline
A small suggestion: Enclose the code with [code] [/code] for a more beautiful appearance, heh heh

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>"
Floor 7 Posted 2007-03-23 10:11 ·  中国 河北 保定 联通
银牌会员
★★★
Credits 1,513
Posts 554
Joined 2005-12-30 00:50
20-year member
UID 48180
Gender Male
Status Offline
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!
Floor 8 Posted 2007-03-23 10:17 ·  中国 河北 保定 联通
银牌会员
★★★
Credits 1,513
Posts 554
Joined 2005-12-30 00:50
20-year member
UID 48180
Gender Male
Status Offline
[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]]
Floor 9 Posted 2007-03-23 12:38 ·  中国 四川 成都 教育网
铂金会员
★★★★
Credits 7,493
Posts 2,672
Joined 2005-09-02 00:00
20-year member
UID 42173
Gender Male
Status Offline
This is it:

WScript.Echo "Hello, world!'


WScript.Echo "Hello, world!'


Almost universal in almost all forums

[ Last edited by electronixtar on 2007-3-23 at 12:39 PM ]

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>"
Floor 10 Posted 2007-03-23 12:45 ·  中国 广西 玉林 博白县 电信
金牌会员
★★★★
Credits 3,687
Posts 1,467
Joined 2005-08-08 12:00
20-year member
UID 44210
Status Offline
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.)
Floor 11 Posted 2007-03-24 09:14 ·  中国 安徽 马鞍山 电信
中级用户
★★
Credits 397
Posts 168
Joined 2006-10-08 10:07
19-year member
UID 64934
Status Offline
How great it is not to be encrypted! Like! Like!
Floor 12 Posted 2007-03-24 12:33 ·  中国 河北 保定 联通
银牌会员
★★★
Credits 1,513
Posts 554
Joined 2005-12-30 00:50
20-year member
UID 48180
Gender Male
Status Offline
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...
Forum Jump: