Try running your batch file like so:

Dim oShell, oExec
Set oShell = CreateObject("Wscript.Shell")
Set oExec = oShell.Exec("your batch file path")
Response.Write "<pre>"
Response.Write oExec.StdOut.ReadAll
Response.Write "</pre>"
Set oExec = Nothing
Set oShell = Nothing

Ray at home
 

> -----Original Message-----
> From: Ross St. Clair [mailto:[EMAIL PROTECTED] 
> Sent: Friday, April 01, 2005 7:09 AM
> To: [email protected]
> Subject: RE: [ASP] Execute Batch File
> 
> 
> At first, my batch was merely doing a "CD /D" to a network 
> drive and then executing a special mail application.  I was 
> able to call this application directly from ASP, but I was 
> getting an error back from the app itself.  I thought I could 
> solve this by first changing the directory to where it 
> resided (hence the use of a batch file to run it).
> 
> I scaled the batch file back and tried several versions with 
> simple commands (ECHOs, PING, etc.).  Whenever I ran the app 
> directly from ASP, I would get a true return code from the 
> app.  Whenever I run the batch (regardless of its 
> complexity), I always get back a "1" from the "Run" method.  
> I figured out a workaround, so I don't particularly need the 
> batch file, but it would be nice to find out what's going on.
> 
> Thanks for the help...
> 
> -- Ross
> 
> --- Ray at home <[EMAIL PROTECTED]> wrote:
> 
> > 
> > Also, can you post the contents of your batch file?
> > 
> > Ray at home
> > 
> > > -----Original Message-----
> > > From: David Horowitz [mailto:[EMAIL PROTECTED]
> > > Sent: Thursday, March 31, 2005 9:01 PM
> > > To: [email protected]
> > > Subject: RE: [ASP] Execute Batch File
> > > 
> > > 
> > > Ross,
> > >  
> > > Maybe it's the content of your batch file that's the problem? 
> > > Have you tried some simple batch file as a benchmark?
> > >  
> > > David
> > > 
> > > -----Original Message-----
> > > From: Ross St. Clair [mailto:[EMAIL PROTECTED]
> > > Sent: Thursday, March 31, 2005 11:06 AM
> > > To: ASP Mailing List
> > > Subject: [ASP] Execute Batch File
> > > 
> > > 
> > > I'm having a problem executing a batch file from ASP and I'd be
> > very
> > > appreciate of any help I can get.  The web server is serving the
> > ASP
> > > code from a file server which is also where the batch file
> > exists.  I
> > > can run an executable with no problems (as well as run things
> > like
> > > "ping", etc.), but the batch file will not cooperate.
> > > 
> > > I'm using the Run method of the Wscript.Shell object.  I've tried 
> > > executing the batch file both with and without the "%comspec% /c"
> > in
> > > front of the name and am always getting a return code of 1 from
> > the
> > > Run method and the batch file does nothing.  I've checked
> > permissions
> > > on the files and directories and it appears that "Everyone" has 
> > > read/execute permissions.
> > > 
> > > I'm still completely stumped despite having done several Google 
> > > searches trying to find an answer.
> > > 
> > > Thanks...
> > > 
> > > -- Ross St. Clair
> > > 
> > > 
> > >
> >
> ---------------------------------------------------------------------
> > > 
> > > Home       : http://groups.yahoo.com/group/active-server-pages
> > >
> >
> ---------------------------------------------------------------------
> > > Post       : [email protected]
> > > Subscribe  : [EMAIL PROTECTED]
> > > Unsubscribe: [EMAIL PROTECTED]
> > >
> >
> ---------------------------------------------------------------------
> > 
> > > 
> > > 
> > > 
> > > Yahoo! Groups Sponsor     
> > > 
> > > ADVERTISEMENT
> > >  
> > > <http://us.ard.yahoo.com/SIG=1291l1h9k/M=298184.6018725.703861
> > 9.3001176/
> > > D=groups/S=1705115381:HM/EXP=1112371553/A=2593423/R=0/SIG=11el
> > 9gslf/*htt
> > > p://www.netflix.com/Default?mqso=60190075> click here     
> > >  
> > > <http://us.adserver.yahoo.com/l?M=298184.6018725.7038619.30011
> > 76/D=group
> > > s/S=:HM/A=2593423/rand=616452098>         
> > > 
> > > 
> > >   _____
> > > 
> > > Yahoo! Groups Links
> > > 
> > > 
> > > * To visit your group on the web, go to:
> > > http://groups.yahoo.com/group/active-server-pages/
> > >   
> > > 
> > > * To unsubscribe from this group, send an email to:
> > > [EMAIL PROTECTED]
> > > <mailto:[EMAIL PROTECTED]
> > t=Unsubscr
> > > ibe> 
> > >   
> > > 
> > > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> > > Service <http://docs.yahoo.com/info/terms/> . 
> > > 
> > > 
> > > 
> > > 
> > > [Non-text portions of this message have been removed]
> > > 
> > > 
> > > 
> > > --------------------------------------------------------------
> > > -------    
> > >  Home       : http://groups.yahoo.com/group/active-server-pages
> > >
> >
> ---------------------------------------------------------------------
> > >  Post       : [email protected]
> > >  Subscribe  : [EMAIL PROTECTED]
> > >  Unsubscribe: [EMAIL PROTECTED]
> > >
> >
> ---------------------------------------------------------------------
> > 
> > > Yahoo! Groups Links
> > > 
> > > 
> > > 
> > >  
> > > 
> > > 
> > > 
> > > 
> > 
> > 
> > 
> > 
> >
> ---------------------------------------------------------------------
> >    
> >  Home       : http://groups.yahoo.com/group/active-server-pages
> >
> ---------------------------------------------------------------------
> >  Post       : [email protected]
> >  Subscribe  : [EMAIL PROTECTED]
> >  Unsubscribe: [EMAIL PROTECTED]
> >
> ---------------------------------------------------------------------
> > 
> > Yahoo! Groups Links
> > 
> > 
> > 
> >  
> > 
> > 
> > 
> > 
> 
> 
> 
> --------------------------------------------------------------
> -------    
>  Home       : http://groups.yahoo.com/group/active-server-pages
> ---------------------------------------------------------------------
>  Post       : [email protected]
>  Subscribe  : [EMAIL PROTECTED]
>  Unsubscribe: [EMAIL PROTECTED]
> ---------------------------------------------------------------------
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
> 
> 




---------------------------------------------------------------------    
 Home       : http://groups.yahoo.com/group/active-server-pages
---------------------------------------------------------------------
 Post       : [email protected]
 Subscribe  : [EMAIL PROTECTED]
 Unsubscribe: [EMAIL PROTECTED]
--------------------------------------------------------------------- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/active-server-pages/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to