Environment.ExpandEnvironmentVariables
using System; using System.Collections; class MainClass { public static void Main() { Console.WriteLine(Environment.ExpandEnvironmentVariables("The Path on %computername% is %Path%")); } }