Reputation: 3629
I'm struggling with how to use defined strings within closed quotes for example (""). I have two text boxes one for a IP or share name and one for a drive letter. When I press my button I want it to map the drive. Below is my code.
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
Dim drivePath As String = TextBox1.Text
Dim driveLetter As String = TextBox2.Text
Process.Start("cmd", "/k net use driveLetter drivePath")
End Sub
I'm struggling with how I can use my driveLetter and drivePath strings within the arguments of
Process.Start("cmd", "/k .....")
Any help would be appreciated as I will need to do this sort of thing quite a lot.
Upvotes: 0
Views: 97
Reputation: 59
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
Dim drivePath As String = TextBox1.Text
Dim driveLetter As String = TextBox2.Text
Process.Start("cmd", "/k net use " & driveLetter & " " & drivePath)
End Sub
Upvotes: 1