locked
Execute an exe file from Windows Vista OS RRS feed

  • Question

  • User324378016 posted
    Hi, I have to execute an exe from an ASP in Windows Vista. I have tried ASPExec.Execute and I'm not able to be see the results I have tried WScript.Shell but my page disappears when I try to execute the exe. Can somebody help me to find out a solution Thanks Ann
    Tuesday, January 27, 2009 6:37 AM

Answers

  • User744767459 posted

    Hi,

    “I'm not able to be see the results” , do you means you can’t see the UI of the application? It is reasonable. For example, if you want to run a console application on the server machine. You have to use your own account as the IIS application pool identity used to execute that command. This makes this IIS worker process have the same Desktop Session with you current logon account on the local machine. However using console output in a server-side web application isn’t a good idea.

    I’d suggest you run the application background and specify a output file to verify this. With the WScript.Shell,  below is a simple code you can run to verify the result by the output file in the specified folder(C:\test.txt).
    <%
          Dim wshell, intReturn
          set wshell = server.createobject("wscript.shell")
          intReturn = wshell.run("%windir%\system32\cmd.exe /c dir *.* > c:\test.txt", 0, True)
          Response.Write( intReturn )
          set wshell = nothing
    %>
    Note: make sure  both the user logon account and the application pool identity have permissions on the Cmd.exe.

    Additionally, some information about the Run method of the WScript.Shell object , for your reference:
    Run Method (Windows Script Host)
    http://msdn.microsoft.com/en-us/library/d5fk67ky(VS.85).aspx

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Monday, February 2, 2009 12:15 AM

All replies

  • User744767459 posted

    Hi,

    “I'm not able to be see the results” , do you means you can’t see the UI of the application? It is reasonable. For example, if you want to run a console application on the server machine. You have to use your own account as the IIS application pool identity used to execute that command. This makes this IIS worker process have the same Desktop Session with you current logon account on the local machine. However using console output in a server-side web application isn’t a good idea.

    I’d suggest you run the application background and specify a output file to verify this. With the WScript.Shell,  below is a simple code you can run to verify the result by the output file in the specified folder(C:\test.txt).
    <%
          Dim wshell, intReturn
          set wshell = server.createobject("wscript.shell")
          intReturn = wshell.run("%windir%\system32\cmd.exe /c dir *.* > c:\test.txt", 0, True)
          Response.Write( intReturn )
          set wshell = nothing
    %>
    Note: make sure  both the user logon account and the application pool identity have permissions on the Cmd.exe.

    Additionally, some information about the Run method of the WScript.Shell object , for your reference:
    Run Method (Windows Script Host)
    http://msdn.microsoft.com/en-us/library/d5fk67ky(VS.85).aspx

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Monday, February 2, 2009 12:15 AM
  • User324378016 posted
    Thanks a lot Leo Tang.
    Wednesday, February 4, 2009 4:52 AM