Execute Dos Commands in Classic ASP

0
172

Steps to Execute DOS Commands in ASP , here i am about to print hostname in ASP while executing from command line , it ll be like this

Image

 

 

Set wShell1 = CreateObject(“WScript.Shell”)
Set cmd1 = wShell1.Exec(“hostname”)
output1 = cmd1.StdOut.Readall()
set cmd1 = nothing: Set wShell1 = nothing

‘ Print Result( replace VB Newline with <br> for HTML)

response.write “.<br>” & replace(output1,vbCrLf,”<br>”)

Screen output on Browser

Image

(result intentionally crossed)

LEAVE A REPLY

Please enter your comment!
Please enter your name here