run batch file in client side

  • Thread starter Thread starter viki
  • Start date Start date
V

viki

Hi,
I want to run the batch file from the client side. I was able to do it
in the server side by using process. But i want to run from the client
side , like we do in asp using createobject("wscript.shell").

I tried the same code by using the html control and the client side
code, but it gives me the error in createobject statement.

Is there any way to run the batch files in the client, could some one
help me with the code....

Thanks in advance,
Viki
 
Hi,

Are you trying to run commands on the users machine via scripting commands
inside of a webpage?

Firstly, this would only work if the user is running Internet Explorer as a
browser.

Secondly, you would still run in to serious security/permission issues. For
safety, IE will not let untrusted webpages access to such powerfull objects
as "wscript.shell".

-- David
 
Hi David,
Thanks for the reply, yes i want run the commands on the users machine
.. This is a intranet web , and everyone are using IE.

Could u please explain me how could i do this and what is the
security/permission issues i have to overcome inorder to do this...

Thanks,
Viki
 
You can try this,
<SCRIPT type="text/javascript" LANGUAGE="JavaScript">
function executeCommands()
{
// Instantiate the Shell object and invoke
//its execute method.

var oShell = new ActiveXObject("Shell.Application");

var commandtoRun = "Application Path";

// Invoke the execute method.
oShell.ShellExecute(commandtoRun, "", "", "open", "1");
}
</SCRIPT>
 
Hi Saravana,
I got it, Thanks a lot.

Now i am going to ask u another help. Actually i am executing this on
a web control, i want the server side on click event to wait until the
client side onclick event(shell execute) finishes the processing...

thanks in advance,
Viki
 
I dont think it is possible to make server side code to wait till client
side code executes. What you can do is, do all your server work in
serverside onclick event. Finally in that event, use
page.registerstartupscript method to register client side code which has to
be executed when the page is rendered. If you need more details, then get
back to me.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top