Wscript. Shell object

Source: Internet
Author: User
The WshShell object ProgIDwscript. shell file name WSHom. OcxCLSIDF935DC22-1CF0-11d0-ADB9-00C04FD58A0BIIDF935DC21-1CF0-11d0-ADB9-00C04FD58A0B The following table describes the properties related to the WshShell object. Attribute description Environment returns the WshEnvironment collection object. SpecialFolder

WshShell object
ProgID wscript. shell
File Name WSHom. Ocx
CLSID F935DC22-1CF0-11d0-ADB9-00C04FD58A0B
IID F935DC21-1CF0-11d0-ADB9-00C04FD58A0B


The following table describes the properties related to the WshShell object.

Attribute description
Environment returns the WshEnvironment collection object.
SpecialFolders uses the WshSpecialFolders object to provide access to Windows shell Folders, such as desktop folders, Start Menu folders, and personal document folders.


The following table describes the methods related to the WshShell object.

Method description
CreateShortCutCreate and return the WshShortcut object.
ExpandEnvironmentSTrIngs extends the PROCESS environment variable and returns the result string.
Popup displays the message window containing the specified message.
RegDelete deletes the specified key or value from the registry.
RegRead returns the specified key or value from the registry.
RegWrite sets the specified key or value in the registry.
Run creates a new process, which runs the specifiedCommand.


WshShell. Environment
The Environment attribute returns the WshEnvironment object.

Syntax
WshShell. Environment ([strType]) = ob1_shenvironment

Note
If strType specifies the location of the environment variable, the values may be "System", "User", "Volatile", and "Process ". If strType is not provided, this method retrieves system environment variables in Windows NT or process environment variables in Windows 95.

For Windows 95, the strType parameter only supports "Process ".

The following variables are provided by the Windows operating system. The script can also obtain environment variables set by other applications.

Description
NUMBER_OF_PROCESSORS: Number of processors running on the computer.
PROCESSOR_ARCHITECTURE the type of processor used by the user workstation.
PROCESSOR_IDENTIFIER the processor ID of the user workstation.
PROCESSOR_LEVEL the processor level of the user workstation.
PROCESSOR_REVISION the processor version of the user workstation.
The operating system used by the OS user workstation.
COMSPEC command used to run the "command prompt" window (usually cmd.ExE ).
HOMEDRIVE local master drive (usually C drive ).
The default path of the HOMEPATH user (usually usersdefault on Windows NT ).
PATH environment variable.
The extension of the PATHEXT executable file (usually. com,. exe,. bat, or. cmd ).
PROMPT command PROMPT (usually $ P $ G ).
The local drive where the SYSTEMDRIVE system is located (for example, c :).
SYSTEMROOT system directory (for example, c: winnt ). Same as WINDIR.
WINDIR system directory (for example, c: winnt ). Same as SYSTEMROOT.
TEMP stores the directory of temporary files (for example, c: temp ). Users can change the value.
TMP directory for storing temporary files (for example, c: temp ). Users can change the value.


Example
\ 'Retrieve the NUMBER_OF_PROCESSORS system environment variable
Set WshShell = Wscript. CreateObject ("Wscript. Shell ")
Set WshSysEnv = WshShell. Environment ("SYSTEM ")
Wscript. Echo WshSysEnv ("NUMBER_OF_PROCESSORS ")

See
WshEnvironment object


WshEnvironment object
The WshEnvironment object is not provided directly and can be accessed using the WshShell. Environment attribute.

ProgID N/
File Name WSHom. Ocx
CLSID
IID


The following table describes the attributes associated with the WshEnvironment object.

Attribute description
Item.
Count refers to the number of enumerated items.
The number of length enumeration items (JScript ).


The following table describes the methods associated with the WshEnvironment object.

Method description
Remove deletes the specified environment variable.


WshShell. SpecialFolders
The SpecialFolders property provides the WshSpecialFolders object to Access Windows shell Folders, such as desktop folder, Start Menu folder, and personal document folder.

Syntax
WshShell. SpecialFolders = obw.shspecialfolders

Example
\ 'This code fragment shows how to access the desktopFoldEr
Set WshShell = Wscript. CreateObject ("Wscript. Shell ")
MsgBox "Your desktop is" & WshShell. SpecialFolders ("Desktop ")
See
WshSpecialFolders object

WshSpecialFolders object
This object is not provided directly. To obtain the WshSpecialFolders object, use the WshShell. SpecialFolders attribute.

ProgID N/
File Name WSHom. Ocx
CLSID
IID


The following table describes the attributes associated with the WshSpecialFolders object.

Attribute description
Item specifies the full path of the folder (default ).
Count refers to the number of enumerated items.
The number of length enumeration items (JScript ).

WshSpecialFolders. Item
The full path of the folder specified by strFolderName is returned. It is the default property.

Syntax
WshShell. SpecialFolders. Item ("strFolderName") = strFolderPath
WshShell. SpecialFolders ("strFolderName") = strFolderPath

Note
If the requested folder (strFolderName) is unavailable, WshShell. SpecialFolders ("strFolderName") returns NULL. For example, Windows 95 does not have the AllUsersDesktop folder. If strFolderName = AllUsersDesktop, NULL is returned.

Windows 95 and Windows NT 4.0 provide the following specified folders:
AllUsersDesktop
AllUsersStartMenu

AllUsersPrograms

AllUsersStartup

Desktop

Favorites

Fonts

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.