1. Wscript.Shell (Windows Script Host Runtime Library) is an object, and the corresponding file is C:\WINDOWS\system32\ Wshom.ocx,wscript.shell is a component that the server system will use. Shell is the meaning of "shell", this object can perform operating system shell commonly used operations, such as running the program, read and write the registry, environment variables. This object is commonly used in VB or VBS programming.
2. Install Wscript.Shell object: regsvr32 wshom.ocx
Uninstall Wscript.Shell object: Regsvr32-u wshom.ocx or regsvr32/u wshom.ocx
3. For example, assume that mytest*.iso files are in the C: root directory. Create the MyTest directory and copy the Mytest*.iso file to the MyTest directory.
Create a Testcopy.bat file, stored in the C: root directory.
Copy Code code as follows:
MD mytest
Copy C:\mytest*.iso mytest
Pause
Double-click Testcopy.dat to see the newly created MyTest directory and the copied Mytest*.iso file.
There are two ways to hide the cmd command Line window.
(1) Create the Wscript.Shell object, run by the object directly Testcopy.dat file, corresponding VBS file: Testcopy1.vbs, double-click Testcopy1.vbs can see the effect.
Copy Code code as follows:
Dim Objshell
Set Objshell=wscript.createobject ("Wscript.Shell")
Ireturncode=objshell.run ("C:\testcopy.bat", 0,true)
(2) Create the Wscript.Shell object, the object runs the DOS command directly, and the command in Testcopy.dat, corresponding VBS file: Testcopy2.vbs
Copy Code code as follows:
Dim Objshell
Set Objshell=wscript.createobject ("Wscript.Shell")
Ireturncode=objshell.run ("cmd.exe/c md mytest", 0,true)
Ireturncode=objshell.run ("cmd.exe/c copy c:\mytest*.iso mytest", 0,true)