0

On SQL Server 2008 R2 Management Studio, running a SQL command like:

EXEC Master..xp_cmdshell 'C:\path_to_my_winform_app.exe" 

doesn't load my winforms app, says "executing query" but never runs my app.

I need to use SQL to run my own app, which is not a command line app, is a windows form app (.net framework).

How can get SQL Server to call my Winforms application's .exe file?

I tried making a .bat and a cmd file (.bat and .cmd) containing:

 start "" "C:\my_winforms_app.exe"
 exit

and calling the .cmd or .bat file using:

EXEC Master..xp_cmdshell 'C:\path_to_my_caller.cmd" 

EXEC Master..xp_cmdshell 'C:\path_to_my_caller.bat" 

Still show the same "executing query" but never ends, and my windows form app is never opened

How can I do that?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • 2
    You can't. Your sql server instance runs as a service and anything it runs must, in turn, not require user input nor interact with the desktop. You will need to redesign your process (your program most importantly) to not do these things. – SMor Oct 11 '20 at 01:52
  • Just as a side note: SQL Server 2008 and 2008 R2 are **out of extended support** by now - https://www.red-gate.com/simple-talk/sql/database-administration/the-end-of-sql-server-2008-and-2008-r2-extended-support/ - time to upgrade! – marc_s Oct 11 '20 at 06:18
  • are newer version comptaible for ? I meant in order to launch the winform app.Mywinforms is an automated app, requiring no user interaction, but uses winforms, cause uses a webbroser to get some data. Any ideas ? – Alejandro B. Martin Oct 15 '20 at 15:26

0 Answers0