How to export ipconfig results to a text file via

Posted on 2009-12-28
Last Modified: 2013-12-17
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?

Question by:InsProf
    LVL 30

    Expert Comment

    by:Reza Rad
    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
    LVL 6

    Accepted Solution

    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

    Author Comment

    I added the /C to the arguments list and it worked.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Suggested Solutions

    A list of useful business intelligence software.
    Skype is a P2P (Peer to Peer) instant messaging and VOIP (Voice over IP) service – as well as a whole lot more.
    This video demonstrates basic masking and how to edit the mask to reveal the desired image.
    This video shows how use content aware, what it’s used for, and when to use it over other tools.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now