Xp_cmdshell and vbscript

  • Can anyone please help. I am executing a vbscript that automates copying backups to other destinations using xp_cmdshell. What i can't do is capture the error code from the script. I always get 0 for success even if the script has failed. Does anyone know if it is possible to do this or not ?

    Thanks in advance

  • xp_cmdshell returns 0 or 1 for the code it runs (if the underline code can return 0 or 1). Get your vbscript to return 1 for failure, that way you will then be able to capture the failure in sql.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply