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

error handling with wscript.echo 1

Status
Not open for further replies.

TheNewOne

Technical User
Mar 27, 2004
117
SI
Hi forum. I need help with wscript.echo function. I have script, wich downloads certian file from web for updating my antivirus program. How could I include wscript.echo function in my script, that will display a certian message if error happen and other message if everything goes OK. Thx for any help.
 
It depends on how you determine that there is an error. Can you post your code so we can see exactly what you want to check?

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
thx for reply TomThumbKP :) There is my code:

Const OverwriteExisting = True
Set ObjShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
objShell.Run("autodownload / /c:\ides\ides.exe"),1 ,True
objShell.Run ("start c:\ides\ides.exe"),1 ,True
objFSO.DeleteFile "c:\ides\ides.exe"
wscript.timeout = 1000
objFSO.MoveFile "c:\ides\*.*" , "c:\Program Files\Sophos SWEEP for NT\", OverwriteExisting
wscript.quit

I call autodownload aplication from this script, wich is made in VB.net.
Is it possible if any error acours in this script a certian message will be displayed??? Thx
 
Something like this ?
Const OverwriteExisting = True
Set ObjShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
rc = objShell.Run("autodownload / /c:\ides\ides.exe",1 ,True)
If rc <> 0 Then
WScript.Echo "Return code from autodownload=" & rc
WScript.Quit
End If
rc = objShell.Run("start c:\ides\ides.exe",1 ,True)
If rc <> 0 Then
WScript.Echo "Return code from ides=" & rc
WScript.Quit
End If
objFSO.DeleteFile "c:\ides\ides.exe"
wscript.timeout = 1000
objFSO.MoveFile "c:\ides\*.*" , "c:\Program Files\Sophos SWEEP for NT\", OverwriteExisting
wscript.quit

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top