Wrox Programmer Forums
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 28th, 2005, 12:25 AM
Registered User
 
Join Date: Dec 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default How can i run a .bat file from ASP

How can i run a bat file using ASP.My .bat file will be calling an exe.
I tried many code like the ones below
=====================
dim server_shell,RetCode
Set server_shell = server.CreateObject("wscript.shell")
RetCode=server_shell.Run ("c:/Inetpub/wwwroot/og/bat/a.bat",8,false)
When i run this code i can see an error message in server .The applicatoin Failed to intialize properly(0xc0000142)
======================
Set Executor = Server.CreateObject("ASPExec.Execute")
Executor.Application = "cmd.exe"
Executor.Parameters = "/c c:\a.bat"
Executor.ShowWindow = True
Response.Write "Attempting to execute " & Executor.Application & "<br>"
strResult = Executor.ExecuteWinApp()
Response.Write "The result of this call was: " & strResult
=======================


pls give me a solution.



 
Old January 28th, 2005, 01:30 PM
Friend of Wrox
 
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

Please Try this:

   <%
          Dim wshell, intReturn
          set wshell = server.createobject("wscript.shell")
          intReturn = wshell.run("c:/Inetpub/wwwroot/og/bat/a.bat", 0, True)
          Response.Write( intReturn )
          set wshell = nothing
     %>


Om Prakash





Similar Threads
Thread Thread Starter Forum Replies Last Post
Run bat file as part of Setup project adorable.ashish General .NET 0 March 5th, 2008 07:42 AM
Run a .bat or .exe on server plong Classic ASP Basics 2 May 9th, 2006 06:06 AM
bat file doesn't work maroun BOOK: Beginning Cryptography with Java 1 October 25th, 2005 04:59 PM
Run .bat file from Excel VBA Harold Hawken Excel VBA 2 June 23rd, 2005 03:03 PM
Writing to a .BAT file using VB6 rhysduk VB How-To 17 January 7th, 2005 09:06 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.