Option Explicit 'Drop a file on this script (or pass the file as an argument). 'It will create and display a text file identical to what 'would be generated by the DOS DEBUG command. Any differences '(other than the obvious command breaks) is due to the way 'scripting reads binary files as text files. 'To use DEBUG, drop a file on DEBUG.EXE. Keep hitting D to 'display sequential data, hit Q to quit. Hit ? for help. DebugPrint File2String(Wscript.Arguments(0)) Sub DebugPrint(strString) Dim strHexEncode Dim lngPos Dim lngCounter Dim strText Dim fs 'As Scripting.FileSystemObject Dim ts 'As Scripting.TextStream Const TemporaryFolder = 2 Const ForWriting = 2 Set fs = Wscript.CreateObject("Scripting.FileSystemObject") Set ts = fs.GetSpecialFolder(TemporaryFolder).CreateTextFile("debug.txt", True, False) strText = "" strHexEncode = "0000:0100 " lngCounter = 256 For lngPos = 1 To Len(strString) If ((Asc(Mid(strString, lngPos, 1)) > 32) And (Asc(Mid(strString, lngPos, 1)) < 123)) Then strText = strText & Mid(strString, lngPos, 1) Else strText = strText & "." End If strHexEncode = strHexEncode & " " & Right("0" & Hex(Asc(Mid(strString, lngPos, 1))), 2) If lngPos <> 0 Then If (lngPos Mod 16) = 0 Then lngCounter = lngCounter + 16 ts.WriteLine strHexEncode & " " & strText strHexEncode = Left(Right("00000000" & Hex(lngCounter), 8), 4) & ":" & Right(Right("00000000" & Hex(lngCounter), 8), 4) & " " strText = "" Else If (lngPos Mod 8) = 0 Then strHexEncode = strHexEncode & " -" End If End If End If Next ts.WriteLine Left(strHexEncode & String(63," "), 63) & strText ts.Close CreateObject("Wscript.Shell").Run "Notepad.exe """ & fs.GetSpecialFolder(TemporaryFolder).Path & "\debug.txt""", 1 End Sub Function File2String(strFile) 'As String Dim fs 'As Scripting.FileSystemObject Dim ts 'As Scripting.TextStream Const ForReading = 1 Set fs = Wscript.CreateObject("Scripting.FileSystemObject") Set ts = fs.OpenTextFile(strFile, ForReading, True) File2String = ts.ReadAll ts.Close End Function