Using %SystemRoot% in path variables

G

Guest

Is there a way to use wildcards such as %SystemRoot% in a path that I pass to
a string variable for consumption in a method parameter?

Example:

string wmipath = @"%SystemRoot%\System32\WBEM\Repository"

Thanks in advance.
 
T

Truong Hong Thi

One way to expand such variable is the
Environment.ExpandEnvironmentVariables method.

Hope that helps,
Thi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top