CSharpTest.Net
ExpandEnvironment Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Utils Namespace > FileUtils Class : ExpandEnvironment Method

input

Glossary Item Box

Expands environment variables into text, i.e. SystemRoot, or ProgramFiles

Syntax

Visual Basic (Declaration) 
Public Shared Function ExpandEnvironment( _
   ByVal input As String _
) As String
C# 
public static string ExpandEnvironment( 
   string input
)

Parameters

input

Example

Library/Library.Test/TestFileUtils.cs

C#Copy Code
Assert.AreEqual(
    Path.GetFullPath(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Test")),
    Path.GetFullPath(FileUtils.ExpandEnvironment(@"PROGRAMFILES\Test"))
    );
VB.NETCopy Code
Assert.AreEqual(Path.GetFullPath(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Test")), Path.GetFullPath(FileUtils.ExpandEnvironment("PROGRAMFILES\Test")))

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys