Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Launching programs on the webserver via asp

Status
Not open for further replies.

dopehead

MIS
Feb 20, 2003
467
Hi There

How do i launch a piece of cmdline software on the webserver in an asp script with parameters and then parse the result into some type of variabel ?

Regards
Jan

Network Systems Engineer
CCNA/CQS
 
try this

cmd1 = "netsend BertyBigBalls Hi"

set objWSH = Server.CreateObject("WScript.Shell")
result1 = objWSH.Run( cmd1, 1, False )
 
It looks like simonchristieis has the code to make it run, I'd love to know how to get the values returned to asp as well.
 
Yaeh, thats my main concern as well, result1 contains either 0 or 1 i think, it does not return the output from the cmdline appl. to the console.

How exactly would you get that data into the script ?
Jan

Network Systems Engineer
CCNA/CQS
 
Hey i found a piece of code that does the trick :

<% Response.Buffer = true %>
<%
url = &quot;
Set objWShell = CreateObject(&quot;WScript.Shell&quot;)
Set objCmd = objWShell.Exec(&quot;ping &quot; & url)
strPResult = objCmd.StdOut.Readall()
set objCmd = nothing: Set objWShell = nothing

strStatus = &quot;offline&quot;
if InStr(strPResult,&quot;TTL=&quot;)>0 then strStatus = &quot;online&quot;

response.write url & &quot; is &quot; & strStatus
response.write &quot;.<br>&quot; & replace(strPResult,vbCrLf,&quot;<br>&quot;)
%>

This will start a ping and pipe the output top the browser....coool :)

Jan

Network Systems Engineer
CCNA/CQS/CCSP
 
Very cool,

I'll have to check that out and see how it works myself.

Mopacfan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top