I have a problem trying to run a DOS cmd and redirect the output to a text
file.
The code below only works as far as the Messages Boxes display the correct
information, ie. the paths are correct,
but not test.txt file is being created!
The purpose is to catch the output from a reverse DNS Lookup tool
"zwhois.exe.
Eventually, I want to run this code from either a VBS file or a web page,
and display the result on screen, rather than having to run the cmd from a
DOS prompt
The DOS exe file can be downloaded from here:
http://www.zoneedit.com/doc/code/zwhois.exe
' whois.vbs which resides in the same folder as the exe file
Dim objWHShell
Dim scriptPath
Dim exeFile
Dim txtFile
Dim Cmd
' scriptPath is returned with a "\" appended at the end
scriptPath = Left(WScript.ScriptFullName,Len(Wscript.ScriptFullName) -
Len(Wscript.ScriptName))
exeFile = scriptPath & "zwhois.exe -v 217.233.242.39 >> " ' -v = verbose
followed by the IP to query
txtFile =scriptPath & "test.txt"
Cmd = exeFile & txtFile
' MsgBox exeFile
' MsgBox txtFile
' MsgBox Cmd
RunFile Cmd
Sub RunFile(CmdToRun)
On Error Resume Next
Set objWHShell = CreateObject("Wscript.Shell")
objWHShell.Run Chr(34) & CmdToRun & Chr(34)
Set objWHShell = Nothing
End Sub
--
Many Thanks in advance guys
Joseph
philippeoget at hotmail dot com
http://www.geocities.com/philippeoget/a2z/