Checksum of file in vbscript

1.7k Views Asked by At

I have the following command
"C:\Program Files\File Checksum Integrity Verifier\fciv.exe" -sha1 "D:\new.txt"

How to run this command from vbscript? Can anybody help me?

1

There are 1 best solutions below

1
On

VBScript comes with a couple of different ways to execute command lines, both of which are on the WshShell object (WScript.Shell)

Using WshShell.Exec

Dim WshShell, oExec
Set WshShell = CreateObject("WScript.Shell")

Set oExec = WshShell.Exec("""C:\Program Files\File Checksum Integrity Verifier\fciv.exe"" -sha1 ""D:\new.txt""")

Do While oExec.Status = 0
     WScript.Sleep 100
Loop

WScript.Echo oExec.Status

Using WshShell.Run

Dim WshShell
Set WshShell = CreateObject("WScript.Shell")

WshShell.Run """C:\Program Files\File Checksum Integrity Verifier\fciv.exe"" -sha1 ""D:\new.txt""", 1, true