Discussion:
VBScript variable not not executing
(too old to reply)
Cesar Salcido
2014-04-29 17:05:26 UTC
Permalink
Here is my script i have i put together to work with MD5Deep. it runs, however it wont create the log. i would a appreciate a nudge in the right direction to try and figure out where i failed.
when i use the following command it works with full paths it works: md5deep64 -r -t -c Directorytohash > logpath\logname.txt


but when i use the following script it does not log the job run.

Set objShell = CreateObject("Wscript.Shell")

objSource = InputBox("Enter Directory to Hash:" & Chr(13) & Chr(10) & Chr(13) & Chr(10) & "Example: C:\Source\Data", _
"Source Folder")
If objSource = "" Then
Wscript.Quit
Else
Wscript.Echo objSource
End If

objlogpath = InputBox("Please enter the Path and name of the existing log folder: Example: C:\LogFolder\logname.txt" & Chr(13) & Chr(10) & Chr(13) & Chr(10) & "LOG FILE MUST HAVE A .TXT OR .CSV EXTENSION", _
"Log Path and Folder Folder")
If objlogpath = "" Then
Wscript.Quit
Else
Wscript.Echo objlogpath
End If

objcmd = "md5deep64.exe"
objSource = """" & objSource & """"
objswitches = " -r -t -c "
objlog = ">" & objlogpath

objCommand = objcmd & Chr(32) & objswitches & Chr(32) & objSource & Chr(32) & objlog

Wscript.echo objCommand

objShell.Run(objCommand)

MsgBox "Hash Directory Files Has been executed"
R.Wieser
2014-04-30 10:21:16 UTC
Permalink
Cesar,

The ">" redirection (of the output from md5deep64.exe to the logfile) is a
function of CMD.EXE, and I do not see you executing it ...

Try changing

objShell.Run(objCommand)

into
objShell.Run("cmd.exe /c "& objCommand)
(see "cmd /?" for the meaning of the "/c" switch)

Hope that helps
Rudy Wieser
Here is my script i have i put together to work with MD5Deep. it runs,
however it wont create the log. i would a appreciate a nudge in the right
direction to try and figure out where i failed.
md5deep64 -r -t -c Directorytohash > logpath\logname.txt
but when i use the following script it does not log the job run.
Set objShell = CreateObject("Wscript.Shell")
objSource = InputBox("Enter Directory to Hash:" & Chr(13) & Chr(10) &
Chr(13) & Chr(10) & "Example: C:\Source\Data", _
"Source Folder")
If objSource = "" Then
Wscript.Quit
Else
Wscript.Echo objSource
End If
objlogpath = InputBox("Please enter the Path and name of the existing log
folder: Example: C:\LogFolder\logname.txt" & Chr(13) & Chr(10) & Chr(13) &
Chr(10) & "LOG FILE MUST HAVE A .TXT OR .CSV EXTENSION", _
"Log Path and Folder Folder")
If objlogpath = "" Then
Wscript.Quit
Else
Wscript.Echo objlogpath
End If
objcmd = "md5deep64.exe"
objSource = """" & objSource & """"
objswitches = " -r -t -c "
objlog = ">" & objlogpath
objCommand = objcmd & Chr(32) & objswitches & Chr(32) & objSource & Chr(32) & objlog
Wscript.echo objCommand
objShell.Run(objCommand)
MsgBox "Hash Directory Files Has been executed"
Cesar Salcido
2014-04-30 11:41:29 UTC
Permalink
Thank you for the help, your solution worked.
R.Wieser
2014-04-30 12:02:26 UTC
Permalink
Hello Cesar,
Post by Cesar Salcido
Thank you for the help, your solution worked.
Nice to hear that, and you're welcome.

Regards,
Rudy Wieser
Post by Cesar Salcido
Thank you for the help, your solution worked.
Loading...