Hi.
I have written a program in vbscript to capture the console output and write it to a file. My problem is that it is only capturing the last line of output for a particular program. But if I execute a simple command like DIR /B, I get the full output written to my file.
My initial thoughts were that this particular program isn't outputting to the console by line but maybe through an array of values in the background which may explain why I am only getting the last line.
HERE IS MY CODE SAMPLE USING DIR /B: (THIS WORKS USING THE DIR COMMAND BUT NOT JFTP)
Dim consoleOutput, objshell, objScriptExec, FSO, consoleOutput, results
Set objShell = CreateObject("WScript.Shell")
Set objScriptExec = objShell.Exec("dir /b")
Set FSO = CreateObject("Scripting.FileSystemObject")
Set consoleOutput = FSO.OpenTextFile("ftp_audit_log.txt", 8, True)
results = objScriptExec.StdOut.ReadAll
Do While Not objScriptExec.StdOut.AtEndOfStream
results = objScriptExec.StdOut.ReadLine()
consoleOutput.WriteLine(results)
'WScript.Echo results
Loop
consoleOutput.Close
SET consoleOutput = NOTHING
SET FSO = NOTHING
If it helps, the program I am trying to capture the output for is jftp.
Has anyone seen a similar issue like this or have any suggestions that may be able to help me out???
Thanks
I have written a program in vbscript to capture the console output and write it to a file. My problem is that it is only capturing the last line of output for a particular program. But if I execute a simple command like DIR /B, I get the full output written to my file.
My initial thoughts were that this particular program isn't outputting to the console by line but maybe through an array of values in the background which may explain why I am only getting the last line.
HERE IS MY CODE SAMPLE USING DIR /B: (THIS WORKS USING THE DIR COMMAND BUT NOT JFTP)
Dim consoleOutput, objshell, objScriptExec, FSO, consoleOutput, results
Set objShell = CreateObject("WScript.Shell")
Set objScriptExec = objShell.Exec("dir /b")
Set FSO = CreateObject("Scripting.FileSystemObject")
Set consoleOutput = FSO.OpenTextFile("ftp_audit_log.txt", 8, True)
results = objScriptExec.StdOut.ReadAll
Do While Not objScriptExec.StdOut.AtEndOfStream
results = objScriptExec.StdOut.ReadLine()
consoleOutput.WriteLine(results)
'WScript.Echo results
Loop
consoleOutput.Close
SET consoleOutput = NOTHING
SET FSO = NOTHING
If it helps, the program I am trying to capture the output for is jftp.
Has anyone seen a similar issue like this or have any suggestions that may be able to help me out???
Thanks