Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vb script file existence check

Status
Not open for further replies.

ytakbob

Programmer
Jul 20, 2000
105
US
I am running a shell that will simply zip a file (this is working fine).z
Upon returning, I check for existence of the zip file and
even though the file is there, it is failing.

My code looks like this:

getShell.run "c:\temp\test.bat",bWaitOnReturn The file is zipped here

If fso.fileexists(zipped file), then
wscript.quit 0
Else
wscript.quit 1 This is the path it is taking
End If


function getShell ()
set shellObj = Wscript.CreateObject("WScript.Shell")
set getShell = shellObj
end function



Note: The syntax is fine because I put the zip file out and re-run and it works fine.
It seems the getShell.run is not complete before the fileexists check kicks in.


Bob Schmid
bob_schmid@hmis.org
330-746-1010 ext. 1347
 
Try putting the system to sleep:

getShell.run "c:\temp\test.bat" 'Notice no parameters
Wscript.Sleep 15000 'For 15 seconds.

Since u mentioned the syntax is fine, maybe this might work.

laters

Aladdin420
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top