Use %USERNAME% in System.Diagnostics.Process.Start

How Do I use %USERNAME% in System.Diagnostics.Process.Start

Or if there is an equivilant please tell me.

If not , What I am trying to do is a launch an application from "C:\Documents and Settings\%USERNAME\Start Menu\Progarms\My App\App.appref-ms"

Thanks


Answer this question

Use %USERNAME% in System.Diagnostics.Process.Start

  • Fred Malone

    Have a look at the Environment.ExpandEnvironmentVariables method.

  • MavecO

    Dim UserName As String = (Environment.ExpandEnvironmentVariables("%USERNAME%"))

    Process.Start("C:\Documents and Settings\" & UserName & "\Start Menu\Programs\My App\App.appref-ms")



  • Use %USERNAME% in System.Diagnostics.Process.Start