Category:VBS

  • VBS code obtained by computers and users in the domain

    Time:2020-1-18

    Display the names and numbers of all computers in the current domain Copy codeThe code is as follows: Const ADS_SCOPE_SUBTREE = 2 Set objRootDSE = GetObject(“LDAP://rootDSE”) strDomain = ObjRootDSE.Get(“defaultNamingContext”) Set objConnection = CreateObject(“ADODB.Connection”) Set objCommand = CreateObject(“ADODB.Command”) objConnection.Provider = “ADsDSOObject” objConnection.Open “Active Directory Provider” Set objCommand.ActiveConnection = objConnection objCommand.Properties(“Page Size”) = 1000 objCommand.Properties(“Searchscope”) = ADS_SCOPE_SUBTREE […]

  • The implementation code of reading index.dat with vbs

    Time:2020-1-17

    Copy codeThe code is as follows: ‘ +—————————————————————————-+ ‘ | Contact Info | ‘ +—————————————————————————-+ ‘ Author: Vengy ‘ modiy:lcx ‘ Email : [email protected] ‘ Tested: win2K/XP (win9X not tested!) Option Explicit ‘ +—————————————————————————-+ ‘ | Setup constants | ‘ +—————————————————————————-+ Const conBarSpeed=80 Const conForcedTimeOut=3600000 ‘ 1 hour ‘ +—————————————————————————-+ ‘ | Setup Objects and […]

  • Vbs script for text segmentation

    Time:2020-1-16

    Copy codeThe code is as follows: On Error Resume Next ‘Code By NetPatch Set Arg=Wscript.Arguments If Arg.Count=0 Then Wscript.Quit Set Fso = CreateObject(“Scripting.FileSystemObject”) Set Conn = CreateObject(“ADODB.Connection”) Set Rs = CreateObject(“ADODB.Recordset”) path=left(Arg(0),InstrRev(Arg(0),”\”)) Fname=replace(Arg(0),path,””) i=0 Conn.Open “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=”&path&”;Extended Properties=””text;HDR=NO;FMT=Delimited””” ‘Rs.Open “Select count(*) FROM ” & Fname,_ ‘Conn, 3, 3, &H0001 ‘allline=rs(0) Rs.Open “Select * FROM ” […]

  • The code of dividing and merging text file with vbs

    Time:2020-1-15

    However, it is very slow to import tens of thousands of addresses at one time when downloading again in other places, so it is necessary to divide it: (in this TXT file, one address takes up one line)Content of url_split.vbs file: Copy codeThe code is as follows: Set fs =CreateObject(“scripting.filesystemobject”) Set gs =CreateObject(“scripting.filesystemobject”) Set F […]

  • Text file splitting script (VBS)

    Time:2020-1-14

    However, there is no existing segmentation tool that is easy to use under windows, so I used VBS to do a segmentation tool for text files and share it with all netizens. The script code is as follows: Copy codeThe code is as follows: Option Explicit ‘this script is only used to split text files. […]

  • IPod text splitter (VBS version)

    Time:2020-1-13

    So I wrote this short and concise script version of the divider in my spare time in summer vacation. The biggest benefit of the script version can be DIY by the user.I won’t say much about the specific situation. You can refer to the problem of TXT coding, iPod text dividerHere is just a description […]

  • Vbs.runauto script virus analysis

    Time:2020-1-12

    Recently, a colleague’s notebook encountered this virus. This semester, he was giving VBScript to students majoring in computer science, so he analyzed it by the way.First, the virus samples were extracted from the infected computer. Because they were found temporarily and were not specially prepared, they were compressed and saved with WinRAR.Open the compressed file […]

  • Get VBS of host name (cmdlib. WSC)

    Time:2020-1-11

    Copy codeThe code is as follows: strComputer = “.” Set objCmdLib = CreateObject(“Microsoft.CmdLib”) Set objCmdLib.ScriptingHost = WScript.Application Set objWMIService = GetObject(“winmgmts:\\” & strComputer & “\root\cimv2”) WScript.Echo objCmdLib.getHostName(objWMIService)

  • VBS string operation test questions

    Time:2020-1-10

    str=”a|b|c|d” Write a small program to get: a|b|c|d b|c|d|a c|d|a|b d|a|b|c As a result, the str length is not determined, and the format is the upper one. The implementation code is as follows: Copy codeThe code is as follows: str=”a|b|c|d” Call Sort(str, “|”) Function Sort(sSource, sDelimiter) Dim I, J, N, sItems, sTemp sItems = Split(sSource, […]

  • VBS string partition function

    Time:2020-1-9

    Copy codeThe code is as follows: Function CutAndJoin(sSource, iLong, sJoiner) Dim I, N N = Len(sSource) / iLong If(N <> Fix(N))Then N = Fix(N) + 1 For I = 0 To N – 1 CutAndJoin = CutAndJoin & Mid(sSource, I * iLong + 1, iLong) & sJoiner Next If(N > 0)Then CutAndJoin = Left(CutAndJoin, Len(CutAndJoin) […]

  • Collect system information with VBScript and upload it to FTP space

    Time:2020-1-8

    Before boring, I sorted out a copy of this thing, because when the company allocates computers to new employees, it needs to register the equipment once, but it’s very troublesome to check every time. As a result, the following vbs script was born, but it’s a pity that the script is well done, but it […]

  • Using VBS to save the contents of a TXT suffix to HTML format

    Time:2020-1-7

    do.vbs Copy codeThe code is as follows: ‘BY Coo_boi If WScript.Arguments.Count=0 Then WScript.Quit Dim fso,txt,htm txt=WScript.Arguments(0) Set fso=CreateObject(“Scripting.FileSystemObject”) Set htm=fso.CreateTextFile(txt&”.htm”,True) title=fso.GetFile(txt).Name title=Left(title,Len(title)-4) MsgBox title htm.WriteLine “<html>” htm.WriteLine “<head>” htm.WriteLine “<title>”&title&”</title>” htm.WriteLine “</head>” htm.WriteLine “<body>” htm.WriteLine “<h1 align=center>”&title&”</h1>” htm.WriteLine “<hr color=red>” For Each line In Split(fso.OpenTextFile(txt).ReadAll ,vbCrLf) htm.WriteLine line&”<br>” Next htm.WriteLine “</body>” htm.WriteLine “</html>” htm.Close Wscript. […]