Hello again forum,
I am working on a VBA routine that calc and verifies hash files for a series of folders and sub directories, using a command line prog called exactfile.exe (exactfile.com). It is very similar to M$'s FCIV utility, but it is actually supported on Win7/Win8. The issue I am having is that I cannot get the standard output/error/console stream to redirect to a text file. I've written the routine multiple ways, trying to figure out redirection. I was using this site
as a reference.
Here is my VBS approach. This code is dependent on another sub passing folder_name as a string
The VBS then executes using wscript, however, since exf.exe does not return an exit code the same way FCIV.exe does, I need the results redirected to a text file. The results vary from a single line saying "No errors." or multiple lines indicating which files do not match their original hash.
Here are a couple iterations of my BAT approach, where i use the BAT to call the VBS. I really thought I would be able to use the standard redirect > here, since the executable is launched using cmd.exe, but I've not gotten the results I want.
I've scoured more pages than I can count, but no approach seems to work, so far. I would appreciate a second or third set of eyes looking at this with me
Thanks!
WH
I am working on a VBA routine that calc and verifies hash files for a series of folders and sub directories, using a command line prog called exactfile.exe (exactfile.com). It is very similar to M$'s FCIV utility, but it is actually supported on Win7/Win8. The issue I am having is that I cannot get the standard output/error/console stream to redirect to a text file. I've written the routine multiple ways, trying to figure out redirection. I was using this site
HTML:
http://www.robvanderwoude.com/battech_redirection.php
Here is my VBS approach. This code is dependent on another sub passing folder_name as a string
Code:
Dim sFSpec As String: sFSpec = "C:\exf\verify_files.vbs"
Dim sParams As String: sParams = "" & folder_name ' this is passed from another sub routine
Dim sCmd As String: sCmd = """" & sFSpec & """ " & sParams
Dim oWSH: Set oWSH = CreateObject("WScript.Shell")
oWSH.Run sCmd, 1, True
The VBS then executes using wscript, however, since exf.exe does not return an exit code the same way FCIV.exe does, I need the results redirected to a text file. The results vary from a single line saying "No errors." or multiple lines indicating which files do not match their original hash.
Here are a couple iterations of my BAT approach, where i use the BAT to call the VBS. I really thought I would be able to use the standard redirect > here, since the executable is launched using cmd.exe, but I've not gotten the results I want.
Code:
retval = Shell("C:\exf\testing\verify_files.bat " & fldr_name & ">test.txt 2>&1", vbMinimizedFocus)
retval = Shell("C:\exf\testing\verify_files.bat " & fldr_name, vbMinimizedFocus)
I've scoured more pages than I can count, but no approach seems to work, so far. I would appreciate a second or third set of eyes looking at this with me
Thanks!
WH