![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Return code I need to terminate a script and provide a return code to the calling application. The return code can be either TRUE of FALSE I found different syntaxes in different places but none works for me Can anybody please provide a sample of a right syntax? The calling application supports either .exe and "script" files: should I call my vbscript file directly or should I write something like "cscript //B myfile.vbs"? Regards Marius |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Return code "Mario - Roma" <mario@xxxxxx> wrote in message news:%23IKWRhlGJHA.3576@xxxxxx Quote: >I need to terminate a script and provide a return code to the calling >application. > The return code can be either TRUE of FALSE > I found different syntaxes in different places but none works for me > Can anybody please provide a sample of a right syntax? > The calling application supports either .exe and "script" files: should I > call my vbscript file directly or should I write something like "cscript > //B myfile.vbs"? > Regards > Marius wscript.quit(x) where x is the desired return code (an integer) that is then reflected by the %ErrorLevel%. In a robust environment you should invoke your scripts like so: cscript //b //nologo c:\scripts\myfile.vbs so that you don't need to rely on assocations. Remember to include drive + folder for your script file! |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Return code On Sep 19, 9:04*am, "Mario - Roma" <ma...@xxxxxx> wrote: Quote: > I need to terminate a script and provide a return code to the calling > application. > The return code can be either TRUE of FALSE > I found different syntax in different places but none works for me > Can anybody please provide a sample of a right syntax? > The calling application supports either .exe and "script" files: should I > call my vbscript file directly or should I write something like "cscript //B > myfile.vbs"? > Regards > Marius correctly. The other approach relies on the correct file association being set, which presents a small risk that the association is not set. The way to get a True/False return code is ... wsh.quit True or wsh.quit False as the last line of code executed in your script's code. This is not declared as valid in the documentation, but since these boolean arguments are actually stored as -1 and 0 for True and False, respectively, it will work. Your calling code will need to process them in an identical manner. Tom Lavedas =========== http://members.cox.net/tglbatch/wsh/ |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Windows Update for Vista KB946041 return error code 800736B2 | Vista installation & setup | |||
| FTP return code | VB Script | |||
| Live Messenger ignore Win32 API ReadFile return code and 100% CPU | Live Messenger | |||
| COM+ Event System detected a bad return code | Vista General | |||
| ATI Radeon Drivers - Code 43, Code 37 & Code 10 | Vista hardware & devices | |||