Calling batch file from webclass. 
Author Message
 Calling batch file from webclass.

Hi,

I am trying to get a webclass to fire a batch file on the
server. I am not having much luck.

I am trying to fire the batch file using the ShellExecute
code snippets at the bottom.  The odd thing is that when I
test it using VB it works but when I deploy it, it fails.  
I have tried calling the command from within the webclass
and moving it to a library and calling it from there. It
just does not fire the HTML is print out and no error is
displayed.

Questions
Has anyone got this sort of thing to work before?
Does anyone know any reason why this approach cant work?
Does anyone know what I am doing wrong
Does anyone have a working example?

Thank you

Jake
Private Declare Function ShellExecute Lib "shell32.dll"
Alias _
      "ShellExecuteA" (ByVal hwnd As Long, ByVal lpszOp As
_
      String, ByVal lpszFile As String, ByVal lpszParams
As String, _
      ByVal lpszDir As String, ByVal FsShowCmd As Long) As
Long

Public Sub ShellAndWait(ByVal RunProg As String)
     Dim RetVal As Long
     Dim proc As PROCESS_INFORMATION
     Dim StartInf As STARTUPINFO
     StartInf.cb = Len(StartInf)
     'Execute the given path
     RetVal = CreateProcessA(0&, RunProg, 0&, 0&, 1&, _
          NORMAL_PRIORITY_CLASS, 0&, 0&, StartInf, proc)

     'Disable this app until the executed one is done
     RetVal = WaitForSingleObject(proc.hProcess, INFINITE)
     RetVal = CloseHandle(proc.hProcess)
End Sub

.



Sat, 21 Aug 2004 21:58:14 GMT  
 Calling batch file from webclass.
Jake,

    Make sure you application has the proper permission to execute files on
the IIS Server.  Also make user your USER  account has permission(i.e.)
IWAM_<machine_name>, IUSR_<machine_name>, also check to make sure you have
Excute Permission..

I hope this helps.

Omar


Quote:
> Hi,

> I am trying to get a webclass to fire a batch file on the
> server. I am not having much luck.

> I am trying to fire the batch file using the ShellExecute
> code snippets at the bottom.  The odd thing is that when I
> test it using VB it works but when I deploy it, it fails.
> I have tried calling the command from within the webclass
> and moving it to a library and calling it from there. It
> just does not fire the HTML is print out and no error is
> displayed.

> Questions
> Has anyone got this sort of thing to work before?
> Does anyone know any reason why this approach cant work?
> Does anyone know what I am doing wrong
> Does anyone have a working example?

> Thank you

> Jake
> Private Declare Function ShellExecute Lib "shell32.dll"
> Alias _
>       "ShellExecuteA" (ByVal hwnd As Long, ByVal lpszOp As
> _
>       String, ByVal lpszFile As String, ByVal lpszParams
> As String, _
>       ByVal lpszDir As String, ByVal FsShowCmd As Long) As
> Long

> Public Sub ShellAndWait(ByVal RunProg As String)
>      Dim RetVal As Long
>      Dim proc As PROCESS_INFORMATION
>      Dim StartInf As STARTUPINFO
>      StartInf.cb = Len(StartInf)
>      'Execute the given path
>      RetVal = CreateProcessA(0&, RunProg, 0&, 0&, 1&, _
>           NORMAL_PRIORITY_CLASS, 0&, 0&, StartInf, proc)

>      'Disable this app until the executed one is done
>      RetVal = WaitForSingleObject(proc.hProcess, INFINITE)
>      RetVal = CloseHandle(proc.hProcess)
> End Sub

> .



Sun, 22 Aug 2004 12:57:20 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Logon Batch to call a VBS that calls another batch

2. Calling Batch file

3. call a batch file from Access

4. Use batch to call a visio file

5. Calling batch files from QB45

6. passing a filename to a QB program called from a batch file

7. Calling a batch file?

8. How do I call a ms-dos batch file from VB

9. Newbie: Calling a batch file

10. About calling batch file

11. Batch file call with Var

12. Call VBScribt with parameter from DOS Batch file

 

 
Powered by phpBB® Forum Software