Wscript. Shell object details !! (6)

Source: Internet
Author: User
Syntax
Wshshell. regwrite strname, anyvalue, [strtype]

Parameters
Strname
If strname ends with a backslash (\), this method sets the key instead of the value.
The strname parameter must start with the root key of the following column.

Short long
Hkcu HKEY_CURRENT_USER
HKLM HKEY_LOCAL_MACHINE
Hkcr hkey_classes_root
HKEY_USERS
Hkey_current_config

Anyvalue
When the strtype is REG_SZ or reg_expand_sz, The regwrite method automatically converts anyvalue to a string. If strtype is REG_DWORD, anyvalue is converted to an integer. If strtype is REG_BINARY, anyvalue must be an integer.

Strtype
The regwrite method supports the following strtypes: REG_SZ, reg_expand_sz, REG_DWORD, and REG_BINARY. If other data types are passed as strtype, regwrite returns e_invalidarg.
Example
Set wshshell = wscript. Createobject ("wscript. Shell ")

Wshshell. regwrite "hkcu \ scriptengine \ value", "some string value"
Wshshell. regwrite "hkcu \ scriptengine \ key \", 1 "REG_DWORD"

See
Wshshell. regdelete method, wshshell. regwrite Method

Wshshell. Run
Run method to create a new process that runs strcommand in the intwindowstyle window.

Syntax
Wshshell. Run (strcommand, [intwindowstyle], [blnwaitonreturn])

Parameters
Strcommand
Environment variables within the strcommand parameter are automatically extended.

Intwindowstyle
This is the value of the wshowwindow element set for the new process in the startupinfo structure. The meaning is the same as that of the ncmdshow parameter in showwindow. One of the following values is recommended. Name Value Meaning
Sw_hide
0. Hide the window and activate another window.
Sw_minimize
6. Minimize the specified window and activate the next top-level window in Z-order.
Sw_restore
9. Activate and display the window. 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_show
5. Activate and display the window with the current size and position.
Sw_showmaximized
3. Activate the window and maximize the display.
Sw_showminimized
2. Activate the window and minimize the display of the window.
Sw_showminnoactive
7. Minimize the display window. The activity window maintains the activity.
Sw_showna
8. The window is displayed in the current status. The activity window maintains the activity.
Sw_shownoactivate
4. display by the nearest size and position of the window. The activity window maintains the activity.
Sw_shownormal
1. Activate and display a window. If the window is minimized or maximized, It is restored to its original size and position.

Blnwaitonreturn
If you do not specify blnwaitonreturn or its value is false, this 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 ).

Example
'This fragment launches notepad with the current executed script
Set wshshell = wscript. Createobject ("wscript. Shell ")
Wshshell. Run ("Notepad" & wscript. scriptfullname)
Wshshell. Run ("% WinDir % \ Notepad" & wscript. scriptfullname)

'This fragment returns the error code from the executed application
Return = wshshell. Run ("Notepad" & wscript. scriptfullname, 1, true)

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.