Category:VBS

  • VBS function to add content to the specified file

    Time:2022-5-5

    Copy codeThe code is as follows: ‘write a string to the specified file, and the third parameter specifies whether to delete the original content Function Z_WriteFile(sFileName, sText, bAppend) Dim fs, fso, iomode if bAppend = True Then iomode = 8 ‘ForAppending else iomode = 2 ‘ForWriting end if set fs = CreateObject(“Scripting.FileSystemObject”)set fso = fs. […]

  • VBS tutorial: introduction to regular expressions – early origins

    Time:2022-5-5

    Early origin The “ancestor” of regular expressions can be traced back to early research on how the human nervous system works. Two neurophysiologists, Warren McCulloch and Walter Pitts, have developed a mathematical way to describe these neural networks. In 1956, an American mathematician named Stephen Kleene published a paper entitled “representation of neural network events” […]

  • VBS tutorial: introduction to regular expressions – regular expressions

    Time:2022-5-4

    regular expression If 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 […]

  • 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 […]

  • VBS tutorial: introduction to regular expressions

    Time:2022-5-3

    These pages contain information intended to provide a general introduction to regular expressions. Although we try to make the content of each topic independent, most of the information contained in these topics depends on the understanding of the features or concepts introduced earlier. Therefore, it is recommended that you read these topics carefully in order […]

  • VBS implementation of system service backup optimization code

    Time:2022-5-2

    Copy codeThe code is as follows: Option Explicit‘0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Const blnVBSShowCaption=True‘add a description to the generated […]

  • VBS tutorial: properties – volumename property

    Time:2022-5-2

    Volumename property Sets or returns the volume label of the specified drive. Read and write. object.VolumeName [= newname] parameter object Required. Should beDriveThe name of the object. newname Optional. If this parameter is provided, thennewnameFor the specifiedobjectNew name for. explain The following code illustrates how to useVolumeNameProperties: Function ShowVolumeInfo(drvpath) Dim fso, d, s Set fso […]

  • VBS tutorial: attribute – type attribute

    Time:2022-5-1

    Type attribute Returns the type information of a file or folder. For example, for an extension of “Text, return document”. object.Type Object should be the name of a file or folder object. explain The following code illustrates how to useTypeProperty returns the type of folder. In this example, an attempt is made to provide the […]

  • Code for adding programs to self starting items using VBS scripts

    Time:2022-4-30

    Because the editor filters some characters, such as &, the following script may run incorrectly.. Just add & & this character.There are many functions of vbs script, but sometimes we only need some of them. Today, I suddenly want to study how to use vbs script to add programs to self startup items Let’s start […]

  • 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 […]

  • VBS tutorial: properties – totalsize property

    Time:2022-4-29

    Subfolders property Returns a folder that consists of all subfolders in a specified folder, including hidden folders and system foldersFoldersGather. object.SubFolders objectShould beFolderThe name of the object. explain The following code illustrates how to useSubFoldersProperties: Function ShowFolderList(folderspec)   Dim fso, f, f1, s, sf   Set fso = CreateObject(“Scripting.FileSystemObject”)   Set f = fso.GetFolder(folderspec)   Set sf = f.SubFolders   For Each f1 in sf      s […]

  • VBS monitors CPU utilization (if the occupancy rate is maintained at 80% for more than 30 seconds, run a program)

    Time:2022-4-28

    The following code is revised according to the requirements of the landlord: Copy codeThe code is as follows: ‘—————————————- On Error Resume Next   Dim icpuusepercentage ‘record CPU usageDim isecond ‘duration of record usage equal to 100Dim objfilestream’txt text read / write stream, used to record logsDim objtextfilewriter’txt write objectDim objshell ‘shell’ object, which is […]