Home All Groups Group Topic Archive Search About

how to run a bat file in remote PC through ASP

Author
10 Oct 2006 6:13 AM
kk.simhadri
Hi everybody,

I want to run a bat file which is on different PC in the same network.

I am able to run a batch file in my PC through the following code

<%
    set wshell = CreateObject("WScript.Shell")
    wshell.run "c:\file.bat"
    set wshell = nothing
%>

but if I change the path to some network ,like

<%
    set wshell = CreateObject("WScript.Shell")
    wshell.run "\\10.101.xx.xxx\folder\file.bat"
    set wshell = nothing
%>

the code is not working.

Does anybody have an idea on how to run the batch file in network
through ASP?

Any help would be appreciated.

Author
10 Oct 2006 7:02 AM
Evertjan.
wrote on 10 okt 2006 in microsoft.public.inetserver.asp.general:

Show quoteHide quote
> Hi everybody,
>
>  I want to run a bat file which is on different PC in the same network.
>
> I am able to run a batch file in my PC through the following code
>
> <%
>     set wshell = CreateObject("WScript.Shell")
>     wshell.run "c:\file.bat"
>     set wshell = nothing
> %>
>
> but if I change the path to some network ,like
>
> <%
>     set wshell = CreateObject("WScript.Shell")
>     wshell.run "\\10.101.xx.xxx\folder\file.bat"
>     set wshell = nothing
> %>
>
> the code is not working.

What a strange idea setting up a shell, and then expecting this shell to
run on another machine than the one it is set up in.

> Does anybody have an idea on how to run the batch file in network
> through ASP?

Asp is just a html renderer, and can run allowed processes on the server.

So you will have a proces [the above shell in the case of a .bat] on the
server do that, or compromise the client security by running a proces
[shell & .bat] on the client by html.

Or you could skedule a proces on the client interrogating a server's .asp 
file regularly if a client .bat file should be started.

All 3 are outside asp, this NG's topic.

So the answer to your Q seems to be: "impossible".

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Are all your drivers up to date? click for free checkup

Author
10 Oct 2006 11:27 AM
Dave Anderson
kk.simha***@gmail.com wrote:
> Does anybody have an idea on how to run the batch file
> in network through ASP?

It may be possible to use ASP to initate a batch file on the machine hosting
the ASP script. You could then trigger that process via an HTTP request.

I presume this is not what you are after, however, in which case there is no
advantage to using ASP. I recommend that you check out the MSDN script
repository: http://www.microsoft.com/technet/scriptcenter/scripts/



--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.

Bookmark and Share