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

Error reporting

Status
Not open for further replies.

Calz

Technical User
Nov 14, 2001
103
FR
I have the following within a script which has been tweaked a bit for here

Sub install_app

Wscript.Echo (err.number)
strAppCmd = c:\windows\notepad.exe
call objShell.Run (strAppCMD, 7, True)
Wscript.Echo (err.number)
End Sub

I get 0 then 0 but If I rename notepad the script bombs out rather than give me the error within the script that I can handle, if I add on error resume next it just finishes.

How can I get it to handle the errors?
 
[tt]Sub install_app
[red]on error resume next '<<<add here[/red]
Wscript.Echo (err.number)
strAppCmd = c:\windows\notepad.exe
call objShell.Run (strAppCMD, 7, True)
Wscript.Echo (err.number)
End Sub[/tt]
 
As simple as that :)
Thanks.
 
Yes, it is as simple. But on error resume next of the world won't help compile time error. This is one.
>strAppCmd = c:\windows\notepad.exe
[tt]strAppCmd = [red]"[/red]c:\windows\notepad.exe[red]"[/red][/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top