Set oShell = CreateObject("WScript.Shell") Set oFSO = CreateObject("Scripting.FileSystemObject") Set objFSO = CreateObject("Scripting.FileSystemObject") Const ForReading = 1 Const ForWriting = 2 'define the batch files sBatFile = "c:\Program Files\bginfo\bg_ip.bat" sBatFile2 = "c:\Program Files\bginfo\bg_dns.bat" sBatFile3 = "c:\Program Files\bginfo\bg_dhcp.bat" ' spaces in the path sBatFileShort = oFSO.GetFile(sBatFile).ShortPath sBatFile2Short = oFSO.GetFile(sBatFile2).ShortPath sBatFile3Short = oFSO.GetFile(sBatFile3).ShortPath ' Run the batch file hidden, and let the VBScript wait for the batch file to finish oShell.Run sBatFileShort, 0, True oShell.Run sBatFile2Short, 0, True oShell.Run sBatFile3Short, 0, True 'set ip Set objFile = objFSO.OpenTextFile("c:\Program Files\bginfo\ip.txt", ForReading) strFile = objFile.ReadAll objFile.Close intLength = Len(strFile) strEnd = Right(strFile, 2) If strEnd = vbCrLf Then strFile = Left(strFile, intLength - 2) Set objFile = objFSO.OpenTextFile("c:\Program Files\bginfo\ip.txt", ForWriting) objFile.Write strFile objFile.Close End If 'set dns Set objFile = objFSO.OpenTextFile("c:\Program Files\bginfo\dns.txt", ForReading) strFile = objFile.ReadAll objFile.Close intLength = Len(strFile) strEnd = Right(strFile, 2) If strEnd = vbCrLf Then strFile = Left(strFile, intLength - 2) Set objFile = objFSO.OpenTextFile("c:\Program Files\bginfo\dns.txt", ForWriting) objFile.Write strFile objFile.Close End If 'set dhcp Set objFile = objFSO.OpenTextFile("c:\Program Files\bginfo\dhcp.txt", ForReading) strFile = objFile.ReadAll objFile.Close intLength = Len(strFile) strEnd = Right(strFile, 2) If strEnd = vbCrLf Then strFile = Left(strFile, intLength - 2) Set objFile = objFSO.OpenTextFile("c:\Program Files\bginfo\dhcp.txt", ForWriting) objFile.Write strFile objFile.Close End If