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.
Install Wscript.Shell object: regsvr32 wshom.ocx
Uninstall Wscript.Shell object: Regsvr32-u wshom.ocx or regsvr32/u wshom.ocx
For Example:
1. Create test.bat files, stored in the D: root directory, the role is to copy *txt files to the D:/test directory.
Copy Code code as follows:
MD Test
Copy D:/*.txt D:/test
Pause
2. Create a Wscript.Shell object that runs the Test.dat file directly from the object.
Copy Code code as follows:
var Objshell;
Objshell=new ActiveXObject ("Wscript.Shell");
var ireturncode=objshell.run ("C:/test.bat", 0,true);
3. Create a Wscript.Shell object that runs the cmd command directly from the object.
Copy Code code as follows:
var Objshell
var objshell= new ActiveXObject ("Wscript.Shell")
var ireturncode=objshell.run ("cmd.exe/c MD Test", 0,true)
Ireturncode=objshell.run ("cmd.exe/c copy d:/*.text mytest", 0,true)
The method is very simple, but very practical, here recommended to the small partners