How to export ipconfig results to a text file via

I am trying to programatically( create a file with all ipconfig data, just like the cmd command ipconfig /all > <outputPath>
I used this code, but no file has been created:  
  With pStart.StartInfo
                .UseShellExecute = True
                 .FileName = "cmd.exe"
                .Arguments = "ipconfig.exe /ALL >" + outputPath
            End With

            ' Execute the process and wait for it to exit
            If pStart.Start() Then
            End If

Any suggestions?

Who is Participating?
The first argument should be /C

Try use the full path of the IP Config utility - C:\windows\system32\ipconfig.exe
And the full path of the CMD.EXE - C:\windows\system32\cmd.exe

                 .FileName = "C:\\windows\\system32\\cmd.exe"
                .Arguments = "/C C:\\windows\\system32\\ipconfig.exe /ALL >" + outputPath

Good luck
Reza RadConsultant, TrainerCommented:
don't use cmd.exe , use ipconfig.exe directly
and then after WaitForExit() use :
string result=pStart.StandardOutput.ReadToEnd();

then you can write this string to file

let me know if  you had problem on it
InsProfAuthor Commented:
I added the /C to the arguments list and it worked.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.