user1301351
user1301351

Reputation: 3

VB arguments are not passed

I am trying to pass argument from VB to CMD but it is not working, it will only open me CMD window. Can any one suggest me what am I doing wrong?

Dim start_info As New ProcessStartInfo()

    start_info.FileName = ("cmd.exe")
    start_info.UseShellExecute = False
    start_info.Arguments = "ipconfig"

    Dim proc As New Process
    proc.StartInfo = start_info
    proc.Start()

Upvotes: 0

Views: 61

Answers (1)

krivtom
krivtom

Reputation: 24916

When you run the above code it is the same as calling "cmd.exe ipconfig" which simply launches the command line with argument ipconfig. If you ran that from a command line window you would see no results. You can simplify the above code:

start_info.FileName = ("ipconfig")
start_info.UseShellExecute = False

Upvotes: 2

Related Questions