Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WQL - Select /Where structure

Status
Not open for further replies.

alfie002

Technical User
Mar 3, 2004
121
GB
Dear all,

I have the following piece of code which is to select the Name from the Win_Directory where the corresponding Path has a specific value.

The line in question is

Set colItems=objWMIService.ExecQuery("Select Name from Win32_Directory where Path = 'c:\utilities'")

The query runs without error but doesn't return a value. The c:\utilities does exist on the c:\ drive.


Any ideas why this code isn't returning a value.

Thanks and regards

Alf



 
>Set colItems=objWMIService.ExecQuery("Select Name from Win32_Directory where Path = 'c:\utilities'")

[1] If c:\utilities is a directory and you want to return name of subdirectories, it is this.
[tt]
Set colItems=objWMIService.ExecQuery("Select Name from Win32_Directory where drive=""c:"" and path='\\utilities\\'")[/tt]

[2] If c:\utilities is a directory and you want to return the name of it(self) - not much to ask..., it is this.
[tt]
Set colItems=objWMIService.ExecQuery("Select Name from Win32_Directory where [red]name[/red]='c:[red]\[/red]\utilities'")[/tt]

For this matter, you have no other way than to read the documentation.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top