AddFn.vbs: ------------- Function AddFn(num1,num2) sum=num1+num2 return sum End Function CallingVBS.vbs: ----------------- Number1=5 Number2=7 Set WSHShell = CreateObject("WScript.Shell") WSHShell.Run "wscript AddFn.vbs Number1 Number2" msgbox sum Edited by psnovice Thursday, March 14, 2013 How am I going to use the function from the link so that if my XX is not 0 it will abort? Can I, and how do I, return an int return value to indicate success or failure? Odd that the link detection screwed it up. :/)With best regardsClemens Anhuth Last edited by canhuth on Tue Jul 29, 2008 10:44 am, edited 1 time in total.
one script can run another one using WSHshell.run as you have already done. Take Survey Question has a verified solution. I would like to use sum to do further caluculations on CallingVBS.vbs file. In order for things to work this way, you would have to build up the command string to include the values of those variables rather than just their names.
So Please help. 0 Comments [ + ] Show Comments Comments Please log in to comment Answers 0 Try WScript.Quit(1), WScript.Quit(2), WScript.Quit(3). Example: Batch file for Copying File to a Folder md "C:manageengine" copy "\\sharename\foldername\samplefile.txt" "C:\manageengine" exit /b %ERRORLEVEL% Exit codes for powershell script Use the command Exit $LASTEXITCODE at the end of It would make more sense to include a copy of the function you need directly in your script along these lines: ------------------------ REM CallingVBS.vbs: Function AddFn(num1,num2) sum=num1+num2 return sum End Function Join & Ask a Question Need Help in Real-Time?
L " % 1 " i s n o t a r e c o g n i z e d d e v i c e . This is not "calling" that script in the way one calls a function, but invoking an entirely separate and independent process. 2. To know about Environment variable see the below note. Vbscript Return String H % 1 w a s u n e x p e c t e d a t t h i s t i m e . Ä A d u
p.d.das How helpful is this to you? After it is evaluated, you can set the return code of the actual custom action. T E r r o r o c c u r r e d w h i l e p r o c e s s i n g : % I need to return value from script to VBA.
Thanks for your assistance. Vbscript Set Errorlevel If you spen some timelearning more about how VBScript works as has been suggested I believe you wil eventually understand what Bill and Al are trying to get you to see. more stack exchange communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed Thanks.
Do I have to do this? Thursday, March 14, 2013 8:35 PM Reply | Quote 0 Sign in to vote Go back and read Al Dunbar's response. VSBcript is not designed to treat its source files as code objects, at least not without a lot of additional work. Trademarks belong to their respective owners. Wscript.quit Example
X T h e s y n t a x o f t h e c o m m a n d i s i n c o r r e Encryption in the 19th century How could Talia Winters help the rogue telepaths against Bester? You're the guy in charge who wd have to do the work!Bye & thanks for listeningg Offline Pages: 1 Index »Windows CMD Shell »How to get the error return value from any others?) do NOT reset ERRORLEVELbut that all the rest (real commands which do something) DO reset ERRORLEVEL on completionIs that right?Pretty much, not sure I've ever seen a definitive list
Can all lines in the euclidian plane be ordinary? Vbscript Exit Code 2 But if your goal is to store an unencrypted copy of a password in one of these "library" files, please realize that anyone using your script and having the tiniest bit What clean, non-sticky lubricant can I use for door hinges?
My test.vbs runs a batch file and that batch files creates a log file. SS64 Forum ( SS64 ) Index Latest Posts Search Register Login You are not logged in. WinZip Self extractor/Run WinZip Button Related Links Status-Message Home Page Windows File Protection Query OPSI Product FAQ Shortcut OPSI Documentation PolicyMaker Home Page Network View KiXtart Scripting - Downloads Related Posts Wshshell.run Return Code If Session.Property("CustomErrorStatus") <> "0" Then 'return error MyVBScriptCA = 3 Exit Function End If ' return success MyVBScriptCA = 1 Exit FunctionEnd FunctionThanks,Jeffrey Top jidjan Posts: 7 Joined: Thu Jul 24,
Test1.vbs file: --------------- pw = "abc1" encr="
I am having similar problem with the wscript.quit, do you have a sample vbscript?Thanks,Jidjan Top Cosmin Posts: 5797 Joined: Tue Jul 10, 2007 6:39 pm Contact: Contact Cosmin Website Re: Return For example:Code: Select allif StrData <> 0 then
MyVBScriptCA = 3
MyVBScriptCA = 1
Exit Functionwhere MyVBScriptCA is the main function of your custom This content is currently hidden from public view. My objective is to call EnDeCrypt.vbs from test1.vbs passing parameters pw encr and pw but returning the value of DecryptPW.
This document provides steps on how to return the error codes on .vb scripts, Powershell scripts and batch files.