I am trying to start a process a a different user but it keeps telling me that the "The directory name is invalid".

Dim info As New ProcessStartInfo("notepad")
        info.UseShellExecute = False

        Dim password As String = "Password"
        Dim securePassword As New SecureString()

        For i As Integer = 0 To password.Length - 1
            securePassword.AppendChar(Convert.ToChar(password(i)))
        Next

        info.UserName = "Goku"
        info.Password = securePassword
        info.Domain = "Castle"

        Try
            Process.Start(info)

        Catch ex As System.ComponentModel.Win32Exception
            Console.WriteLine(ex.Message)
        End Try

If I comment out info.username it will launch notepad just not as Goku

So I solved this I needed to add

info.WorkingDirectory = "c:\somewhere"
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.