Calling a program with response

Results 1 to 2 of 2

Thread: Calling a program with response

  1. #1
    Join Date
    Dec 1969

    Default Calling a program with response

    When I call a batch file which pings and pipes to a file it works fine.<BR><BR>When I run a batch file which calls a relatively long-winded program (6-10 seconds) which has its own command to write to a text file it doesn&#039;t work. If I pipe the output of the batch file it is empty (should be since it is writing to a text file, but I was looking for errors), so no help there. If I just run the command from the (instead of calling the batch file) I get the same results...nothing.<BR><BR>I have verified there are no errors in the batch file because running the batch file manually works fine. <BR><BR>Any ideas?

  2. #2
    Sven Cipido Guest

    Default RE: Calling a program with respo

    Hi,<BR><BR>If I understand you correct, then it&#039;s the same problem I had in my project.<BR><BR>I had to call a vbs to do some deletion in batch.<BR><BR>When using wshshell, it didn&#039;t work. When calling manually it works. The reason is, that whs is a windows sripting host, so it opens a hidden window. We had around 20 open tasks on the server.<BR><BR>You need to use cscript (command-line). I have include my solution :<BR><BR>Set wsh = Server.CreateObject("WScript.Shell") <BR> If wsh is nothing then<BR> session("ErrDescription") = "Could not create object &#039;WScript.Shell&#039;"<BR> Response.Redirect "../users/CBWReportError.asp" <BR> end if <BR> on error goto 0<BR> FindShellCommand = "c:winntsystem32cscript.exe " & server.MapPath("cbsdel.vbs") & " //b"<BR><BR> i = wsh.Run (cstr(FindShellCommand))<BR><BR> if err.number &#060;&#062; 0 then<BR> session("ErrDescription") = "An error occured while trying to start the datasetdelete. The returned erro was: " & err.description<BR> Response.Redirect "../users/CBWReportError.asp" <BR> end if<BR> on error goto 0<BR> <BR> set wsh = nothing<BR><BR><BR>In the findshellcommand, you can see we call cscript.exe, than our bathcjob and look at the //b. This is needed to indicate that the job MUST run in batch.<BR><BR>Hopes this helps you out<BR>Sven C.

Posting Permissions

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