run batch file in client side

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
 
G

Guest

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
 
V

viki

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
 
S

Saravana

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>
 
V

viki

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
 
S

Saravana

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.
 
Joined
Oct 11, 2007
Messages
1
Reaction score
0
HI Saravana,

i tried ur code & found that it will give permission denied error for executing the batch file in client side. if u change the permissions in IE security it will execute in client side. u have to enable Initialize and script ActiveX controls not marked as safe for scripting.

but i can't do this as it will allow unidentified scripts to run in my pc. do u know how to do it by any other way?
 
Joined
Aug 20, 2010
Messages
1
Reaction score
0
hi,
please i am new in this forum and new to programming. please i need a little help. i am trying to start up a .bat file from a browser. i know there are some scripts i need to write on a webserver to do this. pls i need help regarding this.
thanks
 

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

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top