Click here to Skip to main content
15,896,727 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to ask is there any way to enter from a textbox.text the text to an open command prompt window from a vb net form?
XML
I want to thank you all I will try all and both solutions exists and fpr the comment I am trying to make an openvpn cliemt and pass the username and password to the openvpn.exe here is the code I know there is a directive from openvpn.exe but the forum is not answered yet, if you know which directive is I would appreciate it <pre lang="vb">If ComboBox1.Text = "" Then
            MsgBox("Select server file from combobox", MsgBoxStyle.OkOnly, "error")
        Else
            openvpnProcess.StartInfo.CreateNoWindow = True
            If CheckBox1.Checked = True Then
                openvpnProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
            Else
                openvpnProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
            End If

            openvpnProcess.EnableRaisingEvents = True
                       openvpnProcess.StartInfo.Arguments = "--config " & Me.ComboBox1.SelectedItem & ""
'openvpnProcess.StartInfo.Arguments = "--password foo " this directive is correct?
                       openvpnProcess.StartInfo.FileName = "C:\Program Files\OpenVPN\bin\openvpn.exe"
            openvpnProcess.StartInfo.WorkingDirectory = "C:\Program Files\OpenVPN\config\"
            openvpnProcess.Start()</pre>
please any help and or tutorial
Posted
Updated 25-Oct-15 7:38am
v2
Comments
Sergey Alexandrovich Kryukov 24-Oct-15 20:32pm    
The question is not about insertion of anything, but the question is: why doing so? Do you really think that processes are started from command prompt? No, this is just one of the normal application which hardly has something to do with what you want to launch. I bet you need to learn what a computer really does instead.
—SA

Yes, there is: Process.Start[^]
 
Share this answer
 
I want to thank you all I will try all and both solutions exists and fpr the comment I am trying to make an openvpn cliemt and pass the username and password to the openvpn.exe here is the code I know there is a directive from openvpn.exe but the forum is not answered yet, if you know which directive is I would appreciate it
VB
If ComboBox1.Text = "" Then
            MsgBox("Select server file from combobox", MsgBoxStyle.OkOnly, "error")
        Else
            openvpnProcess.StartInfo.CreateNoWindow = True
            If CheckBox1.Checked = True Then
                openvpnProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
            Else
                openvpnProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
            End If

            openvpnProcess.EnableRaisingEvents = True
                       openvpnProcess.StartInfo.Arguments = "--config " & Me.ComboBox1.SelectedItem & ""
'openvpnProcess.StartInfo.Arguments = "--password foo " this directive is correct?
                       openvpnProcess.StartInfo.FileName = "C:\Program Files\OpenVPN\bin\openvpn.exe"
            openvpnProcess.StartInfo.WorkingDirectory = "C:\Program Files\OpenVPN\config\"
            openvpnProcess.Start()

please any help and or tutorial
 
Share this answer
 
Comments
Maciej Los 26-Oct-15 14:39pm    
Sounds like comment or another question, not an answer. Please, delete it to avoid down-voting. Post it as new question, but... i'm afraid you should search for such of information on OpenVPN developer's site. I'll start here: https://docs.openvpn.net/docs/access-server/openvpn-access-server-command-line-tools.html
More precisely (but I've never tried this) I think you want to set up STDIN and STDOUT so that you can take your string (from the textbox) and send it (I think with STDIN) to the already open command window. Never tried it though, so no code examples.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900