[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.webservices

how to execute command line code using asp.net

Sunil

1/22/2003 3:01:00 AM

Hello Gurus,

I have a question. Using asp I am able to execute command line code using
wscript commands
ex:
set oshell = server.createobject("wscript.shell")
oShell.Run [command line code]

How can we execute command line code using asp.net. Please let me know.
Thanks in advance

S


2 Answers

Yasser Shohoud [MS]

1/22/2003 9:48:00 PM

0

Sunil,

Have a look at the System.Diagnostics.Process object.

' VB
...
Imports System.Diagnostics
...
p = New System.Diagnostics.Process()
p.StartInfo.FileName = ExeName
p.StartInfo.Arguments = params
p.StartInfo.UseShellExecute = False
p.StartInfo.RedirectStandardOutput = True
p.EnableRaisingEvents = True
p.Start()

That's a pretty ruff example but hopefully you get the idea.

Mike Clark
Microsoft


--
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Sunil" <kadasunil@hotmail.com> wrote in message
news:ecvcDnbwCHA.440@TK2MSFTNGP12...
> Hello Gurus,
>
> I have a question. Using asp I am able to execute command line code using
> wscript commands
> ex:
> set oshell = server.createobject("wscript.shell")
> oShell.Run [command line code]
>
> How can we execute command line code using asp.net. Please let me know.
> Thanks in advance
>
> S
>
>


Sunil

1/23/2003 4:41:00 AM

0

Thanks Mike,

Got it working by using something similar to this

Dim myproc As System.Diagnostics.Process
myproc = New System.Diagnostics.Process

' Do not receive an event when the process exits.
myproc.EnableRaisingEvents = False
' Start Internet Explorer, passing in a Web page.
myproc.Start("IExplore.exe", "http://www.microsoft...)

Sunil


"Michael Clark [MS]" <xwscom1@online.microsoft.com> wrote in message
news:ewxhHelwCHA.2904@TK2MSFTNGP09...
> Sunil,
>
> Have a look at the System.Diagnostics.Process object.
>
> ' VB
> ...
> Imports System.Diagnostics
> ...
> p = New System.Diagnostics.Process()
> p.StartInfo.FileName = ExeName
> p.StartInfo.Arguments = params
> p.StartInfo.UseShellExecute = False
> p.StartInfo.RedirectStandardOutput = True
> p.EnableRaisingEvents = True
> p.Start()
>
> That's a pretty ruff example but hopefully you get the idea.
>
> Mike Clark
> Microsoft
>
>
> --
> Please do not send email directly to this alias. This alias is for
newsgroup
> purposes only.
> This posting is provided "AS IS" with no warranties, and confers no
rights.
>
>
> "Sunil" <kadasunil@hotmail.com> wrote in message
> news:ecvcDnbwCHA.440@TK2MSFTNGP12...
> > Hello Gurus,
> >
> > I have a question. Using asp I am able to execute command line code
using
> > wscript commands
> > ex:
> > set oshell = server.createobject("wscript.shell")
> > oShell.Run [command line code]
> >
> > How can we execute command line code using asp.net. Please let me know.
> > Thanks in advance
> >
> > S
> >
> >
>
>