Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Win32_SubDirectory class

The Win32_SubDirectory association WMI class relates a directory (folder) and one of its subdirectories (subfolders).

The following syntax is simplified from Managed Object Format (MOF) code and includes all of the inherited properties. Properties and methods are in alphabetic order, not MOF order.

Syntax

[Provider("CIMWin32")]class Win32_SubDirectory : CIM_Component
{
  Win32_Directory REF GroupComponent;
  Win32_Directory REF PartComponent;
};

Members

The Win32_SubDirectory class has these types of members:

Properties

The Win32_SubDirectory class has these properties.

GroupComponent
Data type: Win32_Directory
Access type: Read-only
Qualifiers: Key

Reference to the instance representing the properties of the parent directory (folder) in this association.

PartComponent
Data type: Win32_Directory
Access type: Read-only
Qualifiers: Key

Reference to the instance representing the subdirectory (subfolder) part of the association.

Remarks

The Win32_SubDirectory class is derived from CIM_Component.

To return a collection of subfolders for a folder, create an association query that sets the ResultRole to PartComponent. This indicates that all the items in the returned collection must play the role of a PartComponent, or subfolder, of the folder object. To return the parent folder for a folder, set the ResultRole to GroupComponent.

The Win32_SubDirectory class works only on the file system level immediately above or immediately below the specified folder.

Examples

The following VBScript sample returns a list of all subfolders within the folder C:\Scripts.


strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
 & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSubfolders = objWMIService.ExecQuery _
 ("ASSOCIATORS OF {Win32_Directory.Name='c:\scripts'} " _
 & "WHERE AssocClass = Win32_Subdirectory " _
 & "ResultRole = PartComponent")
For Each objFolder in colSubfolders
 Wscript.Echo objFolder.Name
Next

Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2003

Namespace

\root\CIMV2

MOF

CIMWin32.mof

DLL

CIMWin32.dll

See also

Operating System Classes

 

 

Show:
© 2014 Microsoft