Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Mar 2009
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts

    calling vbs from asp

    Im trying to execute a vbs file from asp page
    but it does not work
    It shows script time out error.

    Test.asp
    ============
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    </head>

    <body>
    <%
    Dim objShell
    Dim vbsFile

    vbsFile = Server.MapPath("test.vbs")
    'response.Write(vbsFile)
    Set objShell = Server.CreateObject("Wscript.Shell")

    'objShell.Run "wscript.exe "&vbsFile&" param1 param2", 0, false
    objShell.Run vbsFile

    Set objShell = Nothing

    Response.Write "Done"
    %>
    </body>
    </html>

    test.vbs
    ==================
    dim fs,f
    set fs=CreateObject("Scripting.FileSystemObject")
    set f=fs.CreateTextFile("D:\inetpub\vhosts\abodesindia.com\httpdocs\Property_In_India_Data\abodesdiwali\ test.txt",true)
    f.write("Hello World!")
    f.write("How are you today?")


    'Set oArgs = WScript.Arguments
    'For i = 0 to oArgs.Count - 1
    'code = oArgs(i)
    'f.write(code)
    'Next

    f.close
    set f=nothing
    set fs=nothing

    'msgbox(hcode)

  • #2
    Regular Coder
    Join Date
    May 2012
    Location
    USA
    Posts
    101
    Thanks
    0
    Thanked 7 Times in 7 Posts
    Check out this link to solve your issue regarding calling vbs file from asp page. http://www.sitepoint.com/forums/show...t-via-asp-page

  • #3
    New Coder
    Join Date
    Mar 2009
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for reply. Actually the vbs had some code error due to which asp was not working. Now its working fine


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •