Createobject ("wscript. Shell") Usage

Source: Internet
Author: User

Wscript. shell is the progid of the wshshell object. You can create a wshshell object to run programs, operate the registry, create shortcuts, access system folders, and manage environment variables.

This object has a run method.

Run method to create a new process that runs strcommand in the intwindowstyle window. Syntax wshshell. Run (strcommand, [intwindowstyle], [blnwaitonreturn]) the environment variable of strcommand is automatically extended within the strcommand parameter. Intwindowstyle this is the value of the wshowwindow element set in the startupinfo structure for the new process. The meaning is the same as that of the ncmdshow parameter in showwindow. One of the following values is recommended. The name value indicates that sw_hide0 hides the window and activates another window. Sw_minimize6 minimizes the specified window and activates the next top-level window sorted in Z order. Sw_restore9 is activated and a window is displayed. If the window is minimized or maximized, It is restored to the original size and position. Specify this flag when restoring the minimal window of the application. Sw_show5 is activated with the current size and position, and the window is displayed. Sw_showmaximized3 activates the window and maximizes the display. Sw_showminimized2 activates the window and minimizes the display. Sw_showminnoactive7 minimizes the display window. The activity window maintains the activity. Sw_showna8 is displayed in the current status window. The activity window maintains the activity. Sw_shownoactivate4 is displayed according to the size and position closest to the window. The activity window maintains the activity. Sw_shownormal1 is activated and a window is displayed. If the window is minimized or maximized, It is restored to its original size and position. Blnwaitonreturn if blnwaitonreturn is not specified or its value is false, the method immediately returns to the script for further execution without waiting for the process to end. If blnwaitonreturn is set to true, the run method returns any error code returned by the application. If blnwaitonreturn is not specified or its value is false, run Returns Error code 0 (zero ).

Set wshshell = wscript. Createobject ("wscript. Shell ")
Wshshell. Run "notepad.exe"

Save as the notepad. vbs file. Double-click it to open notepad.

For more information, see:

Http://www.cnblogs.com/wly923/p/3853133.html

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.