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

[Dynamic, Provider("CIMWin32"), UUID("{F25FE469-783E-11d2-90BF-0060081A46FD}"), AMENDMENT]
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, Override ("GroupComponent"), MappingStrings ("WMI|Win32_Directory")

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, Override ("PartComponent"), MappingStrings ("WMI|Win32_Directory")

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

Requirement Value
Minimum supported client
Windows Vista
Minimum supported server
Windows Server 2008
Namespace
Root\CIMV2
MOF
CIMWin32.mof
DLL
CIMWin32.dll

See also

CIM_Component

Operating System Classes