Wscript. Shell object details !! (5)

Source: Internet
Author: User
The following table describes the methods related to the wshurlshortcut object.

Method description
Save saves the shortcut to the specified file system.

Wshurlshortcut. fullname
The fullname attribute provides the complete path of the shortcut object.

Syntax
Wshurlshortcut. fullname = strfullname

Wshurlshortcut. targetpath
The targetpath attribute provides the target path of the shortcut object.

Syntax
Wshurlshortcut. targetpath = strtargetpath

Wshurlshortcut. Save
The Save method saves a shortcut that points to the location specified by the fullname attribute.

Syntax
Wshurlshortcut. Save

Wshshell. expandenvironmentstrings
The expandenvironmentstrings method extends the process environment variable in strstring and returns the result string. The variable is enclosed by '%.

Environment variables are case insensitive.

Syntax
Wshshell. expandenvironmentstrings (strstring) = strexpandedstring

Example
Msgbox "prompt is" & wshshell. expandenviromentstrings ("% prompt % ")

Wshshell. Popup
The popup method displays a pop-up message box window. The messages contained in the message box are specified by strtext. The title of the message box is specified by strtitle. If strtitle is omitted, the window title is Windows Scripting host.

Syntax
Wshshell. Popup (strtext, [natsecondstowait], [strtitle], [nattype]) = intbutton

Note
If natsecondstowait is provided and its value is greater than zero, the message box is closed after natsecondstowait seconds.

What is nattype in Win32? The MessageBox function is the same. The following table lists the values and meanings of nattype. The values in the following table can be combined.

Button type
Value description
0. The "OK" button is displayed.
1. The "OK" and "cancel" buttons are displayed.
2. The "Terminate", "retry", and "Ignore" buttons are displayed.
3. the "yes", "no", and "cancel" buttons are displayed.
4. the "yes" and "no" buttons are displayed.
5. The "retry" and "cancel" buttons are displayed.

Icon type
Value description
16 show the stop icon
32 display question mark icon
48 display exclamation point icon
64 Display Information Mark icon

The above two tables do not cover all nattype values. For a complete list, see the Win32 documentation.

The returned value intbutton indicates the number of the buttons clicked by the user. If you do not click the button before natsecondstowait seconds, set intbutton to-1.

Value description
1 "OK" button
2 "cancel" button
3 "stop" button
4 "retry" button
5 "Ignore" button
6 "yes" button
7 "no" button

Example
Set wshshell = wscript. Createobject ("wscript. Shell ")
Wshshell. Popup "Where do you want to go today? "

See
Wscript. Echo Method

Wscript. Echo
Echo parameters are displayed in the window (in cscript.exe.

Parameters are separated by spaces. In cscript.exe, this method outputs a carriage return/line feed (cr lf) after the last parameter is displayed ).

Syntax
Wscript. Echo [anyarg...]

Example
Wscript. Echo
Wscript. Echo 1, 2, 3
Wscript. Echo "Windows Scripting host is cool ."

Wshshell. regdelete
Regdelete deletes a key or value named strname from the registry.

Syntax
Wshshell. regdelete strname

Parameters
Strname
If strname ends with a backslash (\), this method deletes the key instead of the value.
The strname parameter must start with the root key name of one of the following columns:

Short Root Key name long root key name
Hkcu HKEY_CURRENT_USER
HKLM HKEY_LOCAL_MACHINE
Hkcr hkey_classes_root
HKEY_USERS
Hkey_current_config

Example
Set wshshell = wscript. Createobject ("wscript. Shell ")

Wshshell. regdelete "hkcu \ scriptengine \ value" 'delete value "value"
Wshshell. regdelete "hkcu \ scriptengine \ key \" 'delete key "key"

See
Wshshell. regread method, wshshell. regwrite Method

Wshshell. regread
The regread method returns the registry key or value named strname.

Syntax
Wshshell. regread (strname) = strvalue

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

Short long
Hkcu HKEY_CURRENT_USER
HKLM HKEY_LOCAL_MACHINE
Hkcr hkey_classes_root
HKEY_USERS
Hkey_current_config

Note
The regread method only supports the REG_SZ, reg_expand_sz, REG_DWORD, REG_BINARY, and reg_multi_sz data types. If the registry has other data types, regread returns disp_e_typemismatch.

Example
Set wshshell = wscript. Createobject ("wscript. Shell ")

Wshshell. regread ("hkcu \ scriptengine \ Val") 'read from Value "Val"
Wshshell. regread ("hkcu \ scriptengine \ key \") 'read from key "key"

See
Wshshell. regdelete method, wshshell. regwrite Method

Wshshell. regwrite
The regwrite method sets the registry key or value named strname.

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.