|
 |
asptoday_discuss thread: execute command line args?
Message #1 by "laeg byrne" <laeg_enterprises@y...> on Mon, 3 Dec 2001 10:57:03
|
|
Can an asp page run a command line program? So clicking a button on a
simple asp page runs say a java program on that machine? I can do it in
perl but asp would be much preferred.
Message #2 by =?iso-8859-1?Q?Mikael_=D6stberg?= <Mikael.Ostberg@i...> on Mon, 3 Dec 2001 12:16:52 +0100
|
|
Yes, you can..
There is one component that allows you to send any command you like to the
command line...
The best part is that you can also get the response back and present it on
your ASP page.
Try this ping out, that I made for testing...
<%
Response.Buffer = True
Server.ScriptTimeOut = 900
Function ConvertASCII(strASCII)
strASCII = Replace(strASCII, vbNewLine, "<br>")
strASCII = Replace(strASCII, " ", " ")
ConvertASCII = strASCII
End Function
Set objWSHShell = CreateObject("WScript.Shell")
strCommand = "ping www.mikeeast.it"
Set objExec = objWSHShell.Exec (strCommand)
strOutPut = ""
Do While Not objExec.StdOut.AtEndOfStream
strOutPut = strOutPut & objExec.StdOut.Read(1)
If Instr(strOutPut, vbNewLine) <> 0 Then
Response.Write ConvertASCII(strOutPut)
strOutPut = ""
Response.Flush
End If
Loop
%>
Unfortunately(or should I say luckily) it is turned off on most ISPs. You
can do alot of nasty things if you want, as it is very powerful...
Try it out...
::micke
-----Original Message-----
From: laeg byrne [mailto:laeg_enterprises@y...]
Sent: den 3 december 2001 11:57
To: ASPToday Discuss
Subject: [asptoday_discuss] execute command line args?
Can an asp page run a command line program? So clicking a button on a
simple asp page runs say a java program on that machine? I can do it in
perl but asp would be much preferred.
mikael.ostberg@i...
$subst('Email.Unsub')
Message #3 by "=?iso-8859-1?q?Laeg=20Ent.?=" <laeg_enterprises@y...> on Mon, 3 Dec 2001 12:06:23 +0000 (GMT)
|
|
I have to execute a batch file on the command line,
even though the .bat file resides in the same
directory as this file it says it cannot find it. How
would I change directory (I know, deadly security
risk) using the code below. Thanking you.
laeg
--- Mikael_Östberg <Mikael.Ostberg@i...>
wrote: > Yes, you can..
>
> There is one component that allows you to send any
> command you like to the
> command line...
>
> The best part is that you can also get the response
> back and present it on
> your ASP page.
>
> Try this ping out, that I made for testing...
>
> <%
> Response.Buffer = True
>
> Server.ScriptTimeOut = 900
>
> Function ConvertASCII(strASCII)
> strASCII = Replace(strASCII, vbNewLine, "<br>")
> strASCII = Replace(strASCII, " ", " ")
> ConvertASCII = strASCII
> End Function
>
> Set objWSHShell = CreateObject("WScript.Shell")
> strCommand = "ping www.mikeeast.it"
> Set objExec = objWSHShell.Exec (strCommand)
> strOutPut = ""
> Do While Not objExec.StdOut.AtEndOfStream
> strOutPut = strOutPut & objExec.StdOut.Read(1)
> If Instr(strOutPut, vbNewLine) <> 0 Then
> Response.Write ConvertASCII(strOutPut)
> strOutPut = ""
> Response.Flush
> End If
> Loop
> %>
>
> Unfortunately(or should I say luckily) it is turned
> off on most ISPs. You
> can do alot of nasty things if you want, as it is
> very powerful...
>
> Try it out...
>
> ::micke
>
>
> -----Original Message-----
> From: laeg byrne
> [mailto:laeg_enterprises@y...]
> Sent: den 3 december 2001 11:57
> To: ASPToday Discuss
> Subject: [asptoday_discuss] execute command line
> args?
>
>
>
> Can an asp page run a command line program? So
> clicking a button on a
> simple asp page runs say a java program on that
> machine? I can do it in
> perl but asp would be much preferred.
>
> mikael.ostberg@i...
> $subst('Email.Unsub')
>
> laeg_enterprises@y...
$subst('Email.Unsub')
________________________________________________________________
Nokia 5510 looks weird sounds great.
Go to http://uk.promotions.yahoo.com/nokia/ discover and win it!
The competition ends 16 th of December 2001.
Message #4 by =?iso-8859-1?Q?Mikael_=D6stberg?= <Mikael.Ostberg@i...> on Mon, 3 Dec 2001 14:42:00 +0100
|
|
Hi there,
Wouldn't it be possible to just run this:
Set objExec =3D objWSHShell.Exec ("c:\myBatchFolder\myBatch.bat")
If that doesn't work, try to put the directory where you have your
bat-file
in the path. Maybe that will solve it.
I can run all windows command things, like "net send" and stuff like
that(which I commonly use to bug my colleges).
But.. If you just want to run a java program, you can try this out:
<%
set objJavaObject =3D GetObject("java:helloWorld")
strResult =3D objJavaObject.SayHello()
Response.Write(strResult)
set objJavaObject =3D nothing
%>
::micke
-----Original Message-----
From: Laeg Ent. [mailto:laeg_enterprises@y...]
Sent: den 3 december 2001 13:06
To: ASPToday Discuss
Subject: [asptoday_discuss] RE: execute command line args?
I have to execute a batch file on the command line,
even though the .bat file resides in the same
directory as this file it says it cannot find it. How
would I change directory (I know, deadly security
risk) using the code below. Thanking you.
laeg
--- Mikael_=D6stberg <Mikael.Ostberg@i...>
wrote: > Yes, you can..
>
> There is one component that allows you to send any
> command you like to the
> command line...
>
> The best part is that you can also get the response
> back and present it on
> your ASP page.
>
> Try this ping out, that I made for testing...
>
> <%
> Response.Buffer =3D True
>
> Server.ScriptTimeOut =3D 900
>
> Function ConvertASCII(strASCII)
> strASCII =3D Replace(strASCII, vbNewLine, "<br>")
> strASCII =3D Replace(strASCII, " ", " ")
> ConvertASCII =3D strASCII
> End Function
>
> Set objWSHShell =3D CreateObject("WScript.Shell")
> strCommand =3D "ping www.mikeeast.it"
> Set objExec =3D objWSHShell.Exec (strCommand)
> strOutPut =3D ""
> Do While Not objExec.StdOut.AtEndOfStream
> strOutPut =3D strOutPut & objExec.StdOut.Read(1)
> If Instr(strOutPut, vbNewLine) <> 0 Then
> Response.Write ConvertASCII(strOutPut)
> strOutPut =3D ""
> Response.Flush
> End If
> Loop
> %>
>
> Unfortunately(or should I say luckily) it is turned
> off on most ISPs. You
> can do alot of nasty things if you want, as it is
> very powerful...
>
> Try it out...
>
> ::micke
>
>
> -----Original Message-----
> From: laeg byrne
> [mailto:laeg_enterprises@y...]
> Sent: den 3 december 2001 11:57
> To: ASPToday Discuss
> Subject: [asptoday_discuss] execute command line
> args?
>
>
>
> Can an asp page run a command line program? So
> clicking a button on a
> simple asp page runs say a java program on that
> machine? I can do it in
> perl but asp would be much preferred.
>
> mikael.ostberg@i...
> $subst('Email.Unsub')
>
> laeg_enterprises@y...
$subst('Email.Unsub')
________________________________________________________________
Nokia 5510 looks weird sounds great.
Go to http://uk.promotions.yahoo.com/nokia/ discover and win it!
The competition ends 16 th of December 2001.
mikael.ostberg@i...
$subst('Email.Unsub')
Message #5 by "laeg byrne" <laeg_enterprises@y...> on Mon, 3 Dec 2001 14:53:20
|
|
Hey, I get this error
WshShell.Exec error '80070015'
The device is not ready.
/mypath/myfolder/myfile.asp, line 14
> Hi there,
>
> Wouldn't it be possible to just run this:
>
> Set objExec =3D objWSHShell.Exec ("c:\myBatchFolder\myBatch.bat")
>
> If that doesn't work, try to put the directory where you have your
> bat-file
> in the path. Maybe that will solve it.
>
> I can run all windows command things, like "net send" and stuff like
> that(which I commonly use to bug my colleges).
>
> But.. If you just want to run a java program, you can try this out:
>
> <%
> set objJavaObject =3D GetObject("java:helloWorld")
> strResult =3D objJavaObject.SayHello()
> Response.Write(strResult)
> set objJavaObject =3D nothing
> %>
>
> ::micke
>
>
> -----Original Message-----
> From: Laeg Ent. [mailto:laeg_enterprises@y...]
> Sent: den 3 december 2001 13:06
> To: ASPToday Discuss
> Subject: [asptoday_discuss] RE: execute command line args?
>
>
> I have to execute a batch file on the command line,
> even though the .bat file resides in the same
> directory as this file it says it cannot find it. How
> would I change directory (I know, deadly security
> risk) using the code below. Thanking you.
>
> laeg
>
> --- Mikael_=D6stberg <Mikael.Ostberg@i...>
> wrote: > Yes, you can..
> >
> > There is one component that allows you to send any
> > command you like to the
> > command line...
> >
> > The best part is that you can also get the response
> > back and present it on
> > your ASP page.
> >
> > Try this ping out, that I made for testing...
> >
> > <%
> > Response.Buffer =3D True
> >
> > Server.ScriptTimeOut =3D 900
> >
> > Function ConvertASCII(strASCII)
> > strASCII =3D Replace(strASCII, vbNewLine, "<br>")
> > strASCII =3D Replace(strASCII, " ", " ")
> > ConvertASCII =3D strASCII
> > End Function
> >
> > Set objWSHShell =3D CreateObject("WScript.Shell")
> > strCommand =3D "ping www.mikeeast.it"
> > Set objExec =3D objWSHShell.Exec (strCommand)
> > strOutPut =3D ""
> > Do While Not objExec.StdOut.AtEndOfStream
> > strOutPut =3D strOutPut & objExec.StdOut.Read(1)
> > If Instr(strOutPut, vbNewLine) <> 0 Then
> > Response.Write ConvertASCII(strOutPut)
> > strOutPut =3D ""
> > Response.Flush
> > End If
> > Loop
> > %>
> >
> > Unfortunately(or should I say luckily) it is turned
> > off on most ISPs. You
> > can do alot of nasty things if you want, as it is
> > very powerful...
> >
> > Try it out...
> >
> > ::micke
> >
> >
> > -----Original Message-----
> > From: laeg byrne
> > [mailto:laeg_enterprises@y...]
> > Sent: den 3 december 2001 11:57
> > To: ASPToday Discuss
> > Subject: [asptoday_discuss] execute command line
> > args?
> >
> >
> >
> > Can an asp page run a command line program? So
> > clicking a button on a
> > simple asp page runs say a java program on that
> > machine? I can do it in
> > perl but asp would be much preferred.
> >
> > mikael.ostberg@i...
> > $subst('Email.Unsub')
> >
> > laeg_enterprises@y...
> $subst('Email.Unsub')
>
> ________________________________________________________________
> Nokia 5510 looks weird sounds great.
> Go to http://uk.promotions.yahoo.com/nokia/ discover and win it!
> The competition ends 16 th of December 2001.
>
> mikael.ostberg@i...
> $subst('Email.Unsub')
Message #6 by "laeg byrne" <laeg_enterprises@y...> on Mon, 3 Dec 2001 15:27:32
|
|
I have gotten rid of that last error. It does not seem to execute my
batch file at all. I have a batch file called test.bat
which consists of one line
echo executed > blah.txt
If I type test.bat at the command line it executes it fine. However
I insert the path to the file into your code below but it does nothing???
The asp page returns no error at all. Strange.
> > Hi there,
> >
> > Wouldn't it be possible to just run this:
> >
> > Set objExec =3D objWSHShell.Exec ("c:\myBatchFolder\myBatch.bat")
> >
> > If that doesn't work, try to put the directory where you have your
> > bat-file
> > in the path. Maybe that will solve it.
> >
> > I can run all windows command things, like "net send" and stuff like
> > that(which I commonly use to bug my colleges).
> >
> > But.. If you just want to run a java program, you can try this out:
> >
> > <%
> > set objJavaObject =3D GetObject("java:helloWorld")
> > strResult =3D objJavaObject.SayHello()
> > Response.Write(strResult)
> > set objJavaObject =3D nothing
> > %>
> >
> > ::micke
> >
> >
> > -----Original Message-----
> > From: Laeg Ent. [mailto:laeg_enterprises@y...]
> > Sent: den 3 december 2001 13:06
> > To: ASPToday Discuss
> > Subject: [asptoday_discuss] RE: execute command line args?
> >
> >
> > I have to execute a batch file on the command line,
> > even though the .bat file resides in the same
> > directory as this file it says it cannot find it. How
> > would I change directory (I know, deadly security
> > risk) using the code below. Thanking you.
> >
> > laeg
> >
> > --- Mikael_=D6stberg <Mikael.Ostberg@i...>
> > wrote: > Yes, you can..
> > >
> > > There is one component that allows you to send any
> > > command you like to the
> > > command line...
> > >
> > > The best part is that you can also get the response
> > > back and present it on
> > > your ASP page.
> > >
> > > Try this ping out, that I made for testing...
> > >
> > > <%
> > > Response.Buffer =3D True
> > >
> > > Server.ScriptTimeOut =3D 900
> > >
> > > Function ConvertASCII(strASCII)
> > > strASCII =3D Replace(strASCII, vbNewLine, "<br>")
> > > strASCII =3D Replace(strASCII, " ", " ")
> > > ConvertASCII =3D strASCII
> > > End Function
> > >
> > > Set objWSHShell =3D CreateObject("WScript.Shell")
> > > strCommand =3D "ping www.mikeeast.it"
> > > Set objExec =3D objWSHShell.Exec (strCommand)
> > > strOutPut =3D ""
> > > Do While Not objExec.StdOut.AtEndOfStream
> > > strOutPut =3D strOutPut & objExec.StdOut.Read(1)
> > > If Instr(strOutPut, vbNewLine) <> 0 Then
> > > Response.Write ConvertASCII(strOutPut)
> > > strOutPut =3D ""
> > > Response.Flush
> > > End If
> > > Loop
> > > %>
> > >
> > > Unfortunately(or should I say luckily) it is turned
> > > off on most ISPs. You
> > > can do alot of nasty things if you want, as it is
> > > very powerful...
> > >
> > > Try it out...
> > >
> > > ::micke
> > >
> > >
> > > -----Original Message-----
> > > From: laeg byrne
> > > [mailto:laeg_enterprises@y...]
> > > Sent: den 3 december 2001 11:57
> > > To: ASPToday Discuss
> > > Subject: [asptoday_discuss] execute command line
> > > args?
> > >
> > >
> > >
> > > Can an asp page run a command line program? So
> > > clicking a button on a
> > > simple asp page runs say a java program on that
> > > machine? I can do it in
> > > perl but asp would be much preferred.
> > >
> > > mikael.ostberg@i...
> > > $subst('Email.Unsub')
> > >
> > > laeg_enterprises@y...
> > $subst('Email.Unsub')
> >
> > ________________________________________________________________
> > Nokia 5510 looks weird sounds great.
> > Go to http://uk.promotions.yahoo.com/nokia/ discover and win it!
> > The competition ends 16 th of December 2001.
> >
> > mikael.ostberg@i...
> > $subst('Email.Unsub')
Message #7 by =?iso-8859-1?Q?Mikael_=D6stberg?= <Mikael.Ostberg@i...> on Mon, 3 Dec 2001 16:28:34 +0100
|
|
Have you tried to put the path to the folder which you have your bat-file
in?
::m
-----Original Message-----
From: laeg byrne [mailto:laeg_enterprises@y...]
Sent: den 3 december 2001 15:53
To: ASPToday Discuss
Subject: [asptoday_discuss] RE: execute command line args?
Hey, I get this error
WshShell.Exec error '80070015'
The device is not ready.
/mypath/myfolder/myfile.asp, line 14
> Hi there,
>
> Wouldn't it be possible to just run this:
>
> Set objExec =3D objWSHShell.Exec ("c:\myBatchFolder\myBatch.bat")
>
> If that doesn't work, try to put the directory where you have your
> bat-file
> in the path. Maybe that will solve it.
>
> I can run all windows command things, like "net send" and stuff like
> that(which I commonly use to bug my colleges).
>
> But.. If you just want to run a java program, you can try this out:
>
> <%
> set objJavaObject =3D GetObject("java:helloWorld")
> strResult =3D objJavaObject.SayHello()
> Response.Write(strResult)
> set objJavaObject =3D nothing
> %>
>
> ::micke
>
>
> -----Original Message-----
> From: Laeg Ent. [mailto:laeg_enterprises@y...]
> Sent: den 3 december 2001 13:06
> To: ASPToday Discuss
> Subject: [asptoday_discuss] RE: execute command line args?
>
>
> I have to execute a batch file on the command line,
> even though the .bat file resides in the same
> directory as this file it says it cannot find it. How
> would I change directory (I know, deadly security
> risk) using the code below. Thanking you.
>
> laeg
>
> --- Mikael_=D6stberg <Mikael.Ostberg@i...>
> wrote: > Yes, you can..
> >
> > There is one component that allows you to send any
> > command you like to the
> > command line...
> >
> > The best part is that you can also get the response
> > back and present it on
> > your ASP page.
> >
> > Try this ping out, that I made for testing...
> >
> > <%
> > Response.Buffer =3D True
> >
> > Server.ScriptTimeOut =3D 900
> >
> > Function ConvertASCII(strASCII)
> > strASCII =3D Replace(strASCII, vbNewLine, "<br>")
> > strASCII =3D Replace(strASCII, " ", " ")
> > ConvertASCII =3D strASCII
> > End Function
> >
> > Set objWSHShell =3D CreateObject("WScript.Shell")
> > strCommand =3D "ping www.mikeeast.it"
> > Set objExec =3D objWSHShell.Exec (strCommand)
> > strOutPut =3D ""
> > Do While Not objExec.StdOut.AtEndOfStream
> > strOutPut =3D strOutPut & objExec.StdOut.Read(1)
> > If Instr(strOutPut, vbNewLine) <> 0 Then
> > Response.Write ConvertASCII(strOutPut)
> > strOutPut =3D ""
> > Response.Flush
> > End If
> > Loop
> > %>
> >
> > Unfortunately(or should I say luckily) it is turned
> > off on most ISPs. You
> > can do alot of nasty things if you want, as it is
> > very powerful...
> >
> > Try it out...
> >
> > ::micke
> >
> >
> > -----Original Message-----
> > From: laeg byrne
> > [mailto:laeg_enterprises@y...]
> > Sent: den 3 december 2001 11:57
> > To: ASPToday Discuss
> > Subject: [asptoday_discuss] execute command line
> > args?
> >
> >
> >
> > Can an asp page run a command line program? So
> > clicking a button on a
> > simple asp page runs say a java program on that
> > machine? I can do it in
> > perl but asp would be much preferred.
> >
> > mikael.ostberg@i...
> > $subst('Email.Unsub')
> >
> > laeg_enterprises@y...
> $subst('Email.Unsub')
>
> ________________________________________________________________
> Nokia 5510 looks weird sounds great.
> Go to http://uk.promotions.yahoo.com/nokia/ discover and win it!
> The competition ends 16 th of December 2001.
>
> mikael.ostberg@i...
> $subst('Email.Unsub')
mikael.ostberg@i...
$subst('Email.Unsub')
Message #8 by =?iso-8859-1?Q?Mikael_=D6stberg?= <Mikael.Ostberg@i...> on Mon, 3 Dec 2001 16:41:26 +0100
|
|
Hmm..
I have tried some now as well...
It seems that you only can run certain things... Like net, ping,
ipconfig,
tracert and stuff like that...
I tried to run a bat-file as well and nothing seems to happen. Maybe, I
was
mistaken... I really thought that you could execute anything with that,
since you had the command line... But maybe not...
Maybe someone knows why...?
::m
-----Original Message-----
From: Mikael =D6stberg [mailto:Mikael.Ostberg@i...]
Sent: den 3 december 2001 16:29
To: ASPToday Discuss
Subject: [asptoday_discuss] RE: execute command line args?
Have you tried to put the path to the folder which you have your
bat-file
in?
::m
-----Original Message-----
From: laeg byrne [mailto:laeg_enterprises@y...]
Sent: den 3 december 2001 15:53
To: ASPToday Discuss
Subject: [asptoday_discuss] RE: execute command line args?
Hey, I get this error
WshShell.Exec error '80070015'
The device is not ready.
/mypath/myfolder/myfile.asp, line 14
> Hi there,
>
> Wouldn't it be possible to just run this:
>
> Set objExec =3D3D objWSHShell.Exec ("c:\myBatchFolder\myBatch.bat")
>
> If that doesn't work, try to put the directory where you have your
=3D
> bat-file
> in the path. Maybe that will solve it.=3D20
>
> I can run all windows command things, like "net send" and stuff like
> that(which I commonly use to bug my colleges).
>
> But.. If you just want to run a java program, you can try this out:
>
> <%
> set objJavaObject =3D3D GetObject("java:helloWorld")
> strResult =3D3D objJavaObject.SayHello()
> Response.Write(strResult)
> set objJavaObject =3D3D nothing
> %>
>
> ::micke
>
>
> -----Original Message-----
> From: Laeg Ent. [mailto:laeg_enterprises@y...]
> Sent: den 3 december 2001 13:06
> To: ASPToday Discuss
> Subject: [asptoday_discuss] RE: execute command line args?
>
>
> I have to execute a batch file on the command line,
> even though the .bat file resides in the same
> directory as this file it says it cannot find it. How
> would I change directory (I know, deadly security
> risk) using the code below. Thanking you.
>
> laeg =3D20
>
> --- Mikael_=3DD6stberg <Mikael.Ostberg@i...>
> wrote: > Yes, you can..=3D20
> >=3D20
> > There is one component that allows you to send any
> > command you like to the
> > command line...=3D20
> >=3D20
> > The best part is that you can also get the response
> > back and present it on
> > your ASP page.
> >=3D20
> > Try this ping out, that I made for testing...=3D20
> >=3D20
> > <%
> > Response.Buffer =3D3D True
> >=3D20
> > Server.ScriptTimeOut =3D3D 900
> >=3D20
> > Function ConvertASCII(strASCII)
> > strASCII =3D3D Replace(strASCII, vbNewLine, "<br>")
> > strASCII =3D3D Replace(strASCII, " ", " ")
> > ConvertASCII =3D3D strASCII
> > End Function
> >=3D20
> > Set objWSHShell =3D3D CreateObject("WScript.Shell")
> > strCommand =3D3D "ping www.mikeeast.it"
> > Set objExec =3D3D objWSHShell.Exec (strCommand)
> > strOutPut =3D3D ""
> > Do While Not objExec.StdOut.AtEndOfStream
> > strOutPut =3D3D strOutPut & objExec.StdOut.Read(1)
> > If Instr(strOutPut, vbNewLine) <> 0 Then=3D20
> > Response.Write ConvertASCII(strOutPut)
> > strOutPut =3D3D ""
> > Response.Flush
> > End If
> > Loop
> > %>
> >=3D20
> > Unfortunately(or should I say luckily) it is turned
> > off on most ISPs. You
> > can do alot of nasty things if you want, as it is
> > very powerful...
> >=3D20
> > Try it out...
> >=3D20
> > ::micke
> >=3D20
> >=3D20
> > -----Original Message-----
> > From: laeg byrne
> > [mailto:laeg_enterprises@y...]
> > Sent: den 3 december 2001 11:57
> > To: ASPToday Discuss
> > Subject: [asptoday_discuss] execute command line
> > args?
> >=3D20
> >=3D20
> >=3D20
> > Can an asp page run a command line program? So
> > clicking a button on a=3D20
> > simple asp page runs say a java program on that
> > machine? I can do it in=3D20
> > perl but asp would be much preferred.=3D20
> >=3D20
> > mikael.ostberg@i...
> > $subst('Email.Unsub')
> >=3D20
> > laeg_enterprises@y...
> $subst('Email.Unsub')=3D20
>
> ________________________________________________________________
> Nokia 5510 looks weird sounds great.=3D20
> Go to http://uk.promotions.yahoo.com/nokia/ discover and win it!=3D20
> The competition ends 16 th of December 2001.
>
> mikael.ostberg@i...
> $subst('Email.Unsub')
mikael.ostberg@i...
$subst('Email.Unsub')
mikael.ostberg@i...
$subst('Email.Unsub')
|
|
 |