InsProf
asked on
How to export ipconfig results to a text file via VB.net
Hi,
I am trying to programatically(VB.net) 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
pStart.WaitForExit()
End If
Any suggestions?
Thanks
I am trying to programatically(VB.net) 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
pStart.WaitForExit()
End If
Any suggestions?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I added the /C to the arguments list and it worked.
Thanks
Thanks
and then after WaitForExit() use :
string result=pStart.StandardOutp
then you can write this string to file
let me know if you had problem on it