Click to See Complete Forum and Search --> : VB Script: Calling a BAT file and checking whether the file exists


vikas_k_bhat
October 6th, 2004, 12:03 PM
Hi,

I have a XYZ.BAT file which checks for something and dumps a file done.txt under C:\temp. I want to call XYZ.BAT in VB script file and I want check whether it has dumped done.txt file under c:\temp

that is

call XYZ.BAT
if not exist C:\temp\done.txt goto endChecking

Thanks
Vikas

wrecklesswun
October 7th, 2004, 10:31 PM
Set objFSO = CreateObject("Scripting.FileSystemObject")
if objfso.fileexists("yourfile") then
your action here
end if

vikas_k_bhat
October 20th, 2004, 05:26 PM
Thanks. But if I try to execute pushd . using Exec it gives me an error !!

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

Set oExec = WshShell.Exec("pushd .")

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

WScript.Echo oExec.Status

Do you know why ?