INFO: Using Backslash in Windows Management Instrumentation Strings (242507)



The information in this article applies to:

  • Microsoft Windows Management Instrumentation 1.0
  • Microsoft Windows Management Instrumentation 1.1
  • Microsoft Windows Management Instrumentation 1.5

This article was previously published under Q242507

SUMMARY

The backslash character, "\", is used by Windows Management Instrumentation (WMI) as an escape character in string constants, similar to the usage in C.

MORE INFORMATION

For example, to include a quote within a string constant, you must use \". If you want to have a backslash, you use \\.

Suppose you want to execute a query for the Win32_Directory object where the Name="C:\". You would need the following query:
select * from Win32_Directory where Name="C:\\"
				
The __relpath of the object would be:
Win32_Directory.Name="C:\\"
				

Modification Type:MajorLast Reviewed:9/30/2003
Keywords:kbinfo kbWBEM KB242507