In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly shows you "what are the commonly used VBS code", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "what is commonly used VBS code" this article.
Remove this link from the system start menu:
The copy code is as follows:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\ CLSID\ {2559a1f6-21d7-11d4-bdaf-00c04f60b9f0}]
@ =-
"InfoTip" =-
[HKEY_CLASSES_ROOT\ CLSID\ {2559a1f6-21d7-11d4-bdaf-00c04f60b9f0}\ DefaultIcon]
@ =-
[HKEY_CLASSES_ROOT\ CLSID\ {2559a1f6-21d7-11d4-bdaf-00c04f60b9f0}\ Instance\ InitPropertyBag]
"Command" =-
"Param1" =-
VBS script to realize disk defragmentation
Set WshShell = WScript.CreateObject ("WScript.Shell")
Dim fso, d, dc
Set fso = CreateObject ("Scripting.FileSystemObject")
Set dc = fso.Drives
For Each d in dc
If d.DriveType = 2 Then
Return = WshShell.Run ("defrag" & d & "- f", 1, TRUE)
End If
Next
Set WshShell = Nothing
Schedule tasks to call VBS scripts regularly
The copy code is as follows:
Option Explicit
On Error Resume Next
'generate the file type of the list
Const sListFileType = "wmv,rm,wma"
'relative path where the file is located
Const sShowPath= "."
'Const definition of sort type
Const iOrderFieldFileName = 0
Const iOrderFieldFileExt = 1
Const iOrderFieldFileSize = 2
Const iOrderFieldFileType = 3
Const iOrderFieldFileDate = 4
'The constant definition of sort order and inverse.
Const iOrderAsc = 0
Const iOrderDesc = 1
'The number of files that generate the list
Const iShowCount = 20
'The displayed date format function
Function Cndate2 (date1,intDateStyle)
Dim strdate,dDate1
Strdate=cstr (date1)
If Isdate (strdate) Then
If Left (cstr (strdate), 1) = "0" Then
DDate1=Cdate ("20" + cstr (strdate))
Else
DDate1=Cdate (strdate)
End If
Else
DDate1=Now ()
End If
Select case intDateStyle
Case 1:
Cndate2 = Cstr (Year (dDate1)) + "-" + Cstr (Month (dDate1)) + "-" + Cstr (Day (dDate1))
Case 2:
Cndate2 = Cstr (Month (dDate1)) + "-" + Cstr (Day (dDate1))
Case 3:
Cndate2 = Cstr (Month (dDate1)) + "month" + Cstr (Day (dDate1)) + "day"
Case 4:
Cndate2 = Cstr (year (dDate1)) + year + Cstr (Month (dDate1)) + month + Cstr (Day (dDate1)) + Day
End Select
End Function
Function ListFile (strFiletype,intCompare,intOrder,intShowCount)
Dim sListFile
Dim fso, f, f1, fc, s,ftype,fcount,i,j,k
Dim t1,t2,t3,t4,t5
Dim iMonth,iDay
SListFile = ""
Set fso = CreateObject ("Scripting.FileSystemObject")
Set f = fso.GetFolder (sShowPath)
Set fc = f.Files
Fcount = fc.count
Redim arrFiles (fcount,5)
Redim arrFiles2 (fcount,5)
ITunes 0
'sort
For Each f1 in fc
Ftype = right (f1.name f1.name Len (f1.name)-instrrev (f1.name, ".")
ArrFiles (iPermine 0) = f1.name
ArrFiles (iPermine 1) = ftype
ArrFiles (iMagne2) = f1.size
ArrFiles (iBER3) = f1.type
ArrFiles (iB4) = f1.DateLastModified
I=i+1
Next
For iTunes 0 to fcount-1
For j=i+1 to fcount-1
Select Case intCompare
Case iOrderFieldFileName,iOrderFieldFileExt,iOrderFieldFileType:
If arrFiles (iMagneintCompare) > arrFiles (jPowerintCompare) then
T1 = arrFiles (iPerin0)
T2 = arrFiles (iPol 1)
T3 = arrFiles (iQuery 2)
T4 = arrFiles (iPol 3)
T5 = arrFiles (iQuery 4)
ArrFiles (iGrain0) = arrFiles (jpence0)
ArrFiles (iGrain1) = arrFiles (jpence1)
ArrFiles (iMagne2) = arrFiles (jPower2)
ArrFiles (iMagne3) = arrFiles (jpence3)
ArrFiles (iPol 4) = arrFiles (jBI 4)
ArrFiles (jPower0) = T1
ArrFiles (jPower1) = T2
ArrFiles (jPower2) = T3
ArrFiles (jp3) = T4
ArrFiles (jpen 4) = T5
End if
Case iOrderFieldFileSize:
If cdbl (arrFiles (iMenintCompare)) > cdbl (arrFiles (jPowerintCompare)) then
T1 = arrFiles (iPerin0)
T2 = arrFiles (iPol 1)
T3 = arrFiles (iQuery 2)
T4 = arrFiles (iPol 3)
T5 = arrFiles (iQuery 4)
ArrFiles (iGrain0) = arrFiles (jpence0)
ArrFiles (iGrain1) = arrFiles (jpence1)
ArrFiles (iMagne2) = arrFiles (jPower2)
ArrFiles (iMagne3) = arrFiles (jpence3)
ArrFiles (iPol 4) = arrFiles (jBI 4)
ArrFiles (jPower0) = T1
ArrFiles (jPower1) = T2
ArrFiles (jPower2) = T3
ArrFiles (jp3) = T4
ArrFiles (jpen 4) = T5
End if
Case iOrderFieldFileDate:
If Cdate (arrFiles (iMenintCompare)) > Cdate (arrFiles (jPowerintCompare)) then
T1 = arrFiles (iPerin0)
T2 = arrFiles (iPol 1)
T3 = arrFiles (iQuery 2)
T4 = arrFiles (iPol 3)
T5 = arrFiles (iQuery 4)
ArrFiles (iGrain0) = arrFiles (jpence0)
ArrFiles (iGrain1) = arrFiles (jpence1)
ArrFiles (iMagne2) = arrFiles (jPower2)
ArrFiles (iMagne3) = arrFiles (jpence3)
ArrFiles (iPol 4) = arrFiles (jBI 4)
ArrFiles (jPower0) = T1
ArrFiles (jPower1) = T2
ArrFiles (jPower2) = T3
ArrFiles (jp3) = T4
ArrFiles (jpen 4) = T5
End if
End Select
Next
Next
'generate a list
SListFile = sListFile + ("")
SListFile = sListFile + ("")
SListFile = sListFile + ("name")
SListFile = sListFile + ("")
SListFile = sListFile + ("Media")
SListFile = sListFile + ("")
SListFile = sListFile + ("size")
SListFile = sListFile + ("")
SListFile = sListFile + ("type")
SListFile = sListFile + ("")
SListFile = sListFile + ("update time")
SListFile = sListFile + ("")
Dim iLoopStart,iLoofEnd,iLoopStep
If intOrder = 0 then
ILoopStart = 0
ILoofEnd = fcount-1
ILoopStep = 1
Else
ILoopStart = fcount-1
ILoofEnd = 0
ILoopStep =-1
End if
Dim iCount,sTDStyleClass
ICount = 1
For j=iLoopStart to iLoofEnd Step iLoopStep
If instr (strFiletype,arrFiles (jPower1)) > 0 and iCount1024*1024 then
SListFile = sListFile + cstr (round (arrFiles (jMagine 2) / 1024 take 1024))
SListFile = sListFile + ("MB")
Else
SListFile = sListFile + cstr (round (arrFiles (jMagine 2) / 1024))
SListFile = sListFile + ("KB")
End if
SListFile = sListFile + ("")
SListFile = sListFile + ("")
SListFile = sListFile + cstr (arrFiles (jmem3))
SListFile = sListFile + ("")
SListFile = sListFile + ("")
SListFile = sListFile + (Cndate2 (arrFiles (jpene 4), 4))
SListFile = sListFile + ("")
SListFile = sListFile + ("")
ICount = iCount+1
End if
Next
SListFile = sListFile + ""
ListFile = sListFile
End Function
'generate the procedure for calling the file
Sub ShowFileListContent ()
Dim tUpdatetime,sUpdateContent
Dim fso,f,f_js,f_js_write
Set fso = CreateObject ("Scripting.FileSystemObject")
Set f = fso.GetFolder (sShowPath)
Set f_js = fso.GetFile ("list.js")
'compare the last modification time between the calling file and the folder
If f.DateLastModifiedf_js.DateLastModified then
SUpdateContent = ListFile (sListFileType,iOrderFieldFileDate,iOrderDesc,iShowCount)
Set f_js_write = fso.CreateTextFile ("list.js", True)
'The JS call adds the following pair of [xss_clean]
'f_js_write.Write ("[xss_clean] ('")
F_js_write.Write (sUpdateContent)
'f_js_write.Write ("')")
F_js_write.Close
End If
End Sub
Call ShowFileListContent ()
A vbs script that can replace Netcom's broadband lander.
Dim WshShell, iexplorePath, iexploreselect
IexplorePath= "c:\ Progra~1\ Intern~1\ iexplore.exe"
Set WshShell=WScript.CreateObject ("WScript.Shell")
WshShell.Run iexplorePath
WScript.Sleep 2000
WshShell.AppActivate "users log in online"
WshShell.SendKeys "own account {TAB}"
WshShell.SendKeys "your own password"
WScript.Sleep 2000
WshShell.SendKeys "{ENTER}"
Create shortcuts with VBS scripts
We take the QQ Aqing Enhancement Parametric Configurator as an example to show how to create shortcuts using VBS scripts. The code is as follows:
Code:
Set WshShell = Wscript.CreateObject ("Wscript.Shell")
StrDesktop = WshShell.SpecialFolders ("Desktop")
Set oShellLink = WshShell.CreateShortcut (strDesktop & "\ QQ Aqing Enhancement package Parameter Configurator .lnk")
'create a shortcut object that appears on the desktop with the name "QQ Aqing Enhancement Parameter Configurator"
OShellLink.TargetPath = "C:\ Program Files\ Tencent\ QQ\ Aqing.exe"
'set the execution path of the shortcut
OShellLink.WindowStyle = 1
OShellLink.Hotkey = "Ctrl+Alt+e" 'set the shortcut key for the shortcut
OShellLink.IconLocation = "E:\ Picture\ Aqing.ico" 'sets the icon path for the shortcut
OShellLink.Description = "QQ Aqing Enhancement Pack Parameter Configurator" 'description of setting shortcuts
OShellLink.WorkingDirectory = strDesktop
OShellLink.Save
Save the above code as "CreateShortcut.vbs" (without quotation marks). Double-click CreateShortcut.vbs and a shortcut to the QQ Aqing enhancement package parameter configuration will be created on the desktop.
The biggest advantage of shortcuts established in this way is that the icons of the shortcuts can be changed according to your preferences.
Send email with VBS script!
[code]
Set objEmail = CreateObject ("CDO.Message")
ObjEmail.From = "null_vbt@163.com"
ObjEmail.To = "null_vbt@163.com"
ObjEmail.Subject = "this email was sent by a VBS script"
ObjEmail.Textbody = "if you receive this email, the test is successful!"
ObjEmail.Send
Using vbs script to write Windows XP/2003 Serial number changer
The copy code is as follows:
ON ERROR RESUME NEXT
Dim VOL_PROD_KEY
If Wscript.arguments.count
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.