Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System
- Imports System.IO
- Imports System.IO.File
- Public Class Form1
- Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- 'Creates path for output file & cmd process
- Dim path As String = My.Application.Info.DirectoryPath() & "\ExIpOutput.txt"
- Dim path1 As String = My.Application.Info.DirectoryPath() & "\Ipconfig.txt"
- Dim pathSub As String = path.Substring(2, 3)
- Dim path1Sub As String = path1.Substring(2, 3)
- 'Tests for // in path(s)
- If pathSub = "//" Then
- RemoveCharacter(path, 2)
- Else
- End If
- If path1Sub = "//" Then
- RemoveCharacter(path1, 2)
- Else
- End If
- 'Creates output files
- Dim fs As FileStream = File.Create(path)
- fs.Close()
- Dim fs1 As FileStream = File.Create(path1)
- fs1.Close()
- 'Appends path1 string with quotes to fix spacing
- Dim pathIns As String = """"
- Dim path1F As String = path1.Insert(0, pathIns)
- path1 = path1F
- Dim path1FIns As Integer = path1.Length()
- Dim path1FF As String = path1.Insert(path1FIns, pathIns)
- path1 = path1FF
- 'Appends path string...
- Dim pathF As String = path.Insert(0, pathIns)
- path = pathF
- Dim pathFIns As Integer = path.Length()
- Dim pathFF As String = path.Insert(pathFIns, pathIns)
- path = pathFF
- 'Declares the ExIP Program
- Dim psi As New ProcessStartInfo With {
- .Verb = "runas",
- .FileName = "Cmd",
- .Arguments = "/c " & "nslookup myip.opendns.com resolver1.opendns.com " & "> " & path
- }
- 'Attempts to run the program
- Process.Start(psi)
- 'Declares the IPConf Program
- Dim psi1 As New ProcessStartInfo With {
- .Verb = "runas",
- .FileName = "Cmd",
- .Arguments = "/c " & "ipconfig /all " & "> " & path1
- }
- 'Attempts to run the program
- Process.Start(psi1)
- End Sub
- Function RemoveCharacter(ByVal stringToCleanup, ByVal characterToRemove)
- Return stringToCleanup.Replace(characterToRemove, "")
- End Function
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement