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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Will this script wait for the download before proceeding?

Status
Not open for further replies.

MojoZig

Technical User
Sep 27, 2005
61
US
Ok, new question:

Here's my script:


'''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''

'Adds the HOSTS file
Const OverwriteExisting = TRUE

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set WshShell = WScript.CreateObject("WScript.Shell")
objFSO.CopyFile "\\server\updates\hosts", WshShell.ExpandEnvironmentStrings("%systemroot%\system32\drivers\etc\"), OverwriteExisting

'This copies the SDAT.exe file to C:\ and then installes it with a silent switch
objFSO.CopyFile "\\server\updates\sdat.exe" , "c:\", OverwriteExisting
wshshell.run "c:\sdat.exe -s",,true
set wshshell=Nothing


'''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''

When the script copies the sdat.exe to the computer will it automatically wait for the file to download before moving on to executing the file? I wouldn't want the script to start installing an old sdat that was previously downloaded to the client ... Would I have to put a pause between the two actions?

According to another post, the TRUE at the end of the RUN statement makes the script wait before proceeding on ...

Should I have a TRUE at the end of the download line? Something like:

objFSO.CopyFile "\\server\updates\sdat.exe" , "c:\", OverwriteExisting, TRUE
(I know that's incorrect since I tried it and it errored!) :eek:)

Thanks again!

Tommy
 
You should be fine. The reason you use the true on the wshell.run is because you are spawning a separate process. The copyfile method of the FSO runs in the current process.

If you still wish to verify this for yourself, create a temp script that copies a very large file (something that will take 15 to 20 seconds to copy) and have echo statements before and after the copy. The echo statements will show with the appropriate delay between them.
 
I believe you are correct ... It seems to run fine on my test XP pc even with an old sdat file on the harddrive ... I appreciate your expertise on this!

Tommy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top