WSH calls the winzip command for packaging compression

xiaoxiao2021-03-06  209

To solve this problem, first let's take a look at Windows Scripting Host, referred to as WSH! The following is an explanation given by Microsoft:

WSH is one of the Microsoft script technology series, simply, providing a scripting environment, in this environment, predefined some objects, and other objects in COM can also be used. He uses a script engine to interpret the script, Microsoft supports VBScript and JScript, and third parties can also develop their own scripting engines.

Specific points, you should first comply with some script files (Microsoft self-contained examples, suffix .vbs or .js), then explain him with a program, this program is called Windows Scripting Host, the name of the program is WScript.exe (Or command line cscript.exe), you can check if there are two files in your machine, know if there is WSH. (Win2000 is in WinNT / System32 / Next) This is very like batch files, but the file is not a command line, but a script written by the scripting language.

Let's briefly introduce several built-in objects that are coming from WSH, including:

1. Object WScript provided by WScript.exe as WScript publication to the scripting engine. WSHARGUMENTS is not open; accessed via WScript.Arguments attribute. Entered

2. Objects provided by WSHom.ocx. WSHSHELL automatic object. Progid is WScript.Wshshell. (Note: This is what we have to use, can execute the DOS command) WSHNETWORK auto object. Progid is WScript.WshNetwork. Wshshortcut is undisclosed; accessed through WSHShell.createShortcut. Wshurlshortcut is not open; accessed through WSHSHELL.CREATESHORTCUT method. Wshcollection is not disclosed; accessed through WshNetwork.enumNetworkDrives or WSHNetwork.enumprinterConnection method. Wshenvironment is not open; accessed via WSHShell.Environment attribute. WSHSpecialFolders is not open; accessed via WSHShell.Folder attribute.

They mainly complete environment variables, network login, drive mapping, fast cross-sectional creation, program load, special folder (such as system folder) information acquisition and other functions.

If you support Ado and other COM parts in your system, you can also use it, the following example presentation Opens the writing board to view text files, and create a text file and write it, you can copy him to the Word board, then .vbs is a surfolio store, then double-click him.

'Test.vbs

'Using the shell object startup

Set wshshell = wscript.createObject ("wscript.shell") wshshell.run ("notepad" & wscript.scriptfullname)

'Use COM object scripting.filesystemObject operation text file

Set fs = wscript.createObject ("scripting.filesystemObject") SET A = fs.createtextfile ("c: /testfile.txt", true) a.writeline ("This is a test.") A.close can also be in ASP Wide WEB programming language Apply