1

I am writing for my desktop some application for handling some services. I wrote in C# an application that calculates something (lets call it cl.exe) I created a .bat file that starts the cl.exe. I want to call that .bat file from my javascript so I WShell.Run(**.bat).

2 question:

  1. The javascript program will not continue till the cl.exe will end ? (It is synchronized ?)
  2. The cl.exe returns a value. How can the javascript take it (It is a javascript program that call .bat file that wrapp the execution of the cl.exe) ?

Thanks

2
  • Are you sure about your architecture ? A Web page that launches a .bat file will work only on some specially configured environment. Commented Mar 14, 2010 at 10:25
  • No web page. Sime a windows script that runs on it and not on the web for dealing with administartation stuff. Commented Mar 14, 2010 at 12:23

2 Answers 2

1

To make it wait, the 3rd parameter of WShell.Run should be set to true. See http://msdn.microsoft.com/en-us/library/d5fk67ky(VS.85).aspx

In that case, WShell.Run also returns the return value of the batch file. If I remember correctly, the bat file will return the error code from the last executable run. If not, you can set it with the batch EXIT command

Sign up to request clarification or add additional context in comments.

1 Comment

Can you explain more how to do this ?
0

To return the value, I used simple the System.Enviorment.Exit(TTT) whert TTT is the integer I wanted to return back.

When I started it I got all the time zero as an answear. I discovered that inorder the program be synchronaized it must be called differently.

WshShell.Run(exe file to be run, 3, true);

The true is here for to be synchronaized.

2 Comments

@Roman: this is not a discussion forum. Please edit your question with this new information instead of adding an answer.
But, for this there is the button "answear your question"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.