xpcmdshell

  • exec master.dbo.xp_cmdshell 'D:\CS-Share\Rockwell-witsken\TCPWedgeFiles\TCPSQL.exe 10.1.109.103, [appminimize]'

    I want to execute this program using xpcmdshell. I can fun this from cmd prompt and it works. When I run it from TSQL there is no error but it does nothing. If I exec master.dbo.xp_cmdshell 'DIR D:\CS-Share\Rockwell-witsken\TCPWedgeFiles\' I can see the file.

    Any ideas what I am doing wrong?

  • What output are you expecting to see from this?

  • If I run it from the cmd prompt it minimizes the app on the desktop. When I do it from Shell it does not minimize

  • Sorry, I can't duplicate this behavior. I tried to just start notepad.exe through xp_cmdshell. The process starts and the query just sits and runs until I kill the process through task manager. But the actual app never shows on my screen. I am assuming this app is like PING and has it's own timeout that will kill the process. If not then I am not sure how you would stop the program from running.

    Sorry I couldn't be of more help.

  • Yeah I just tried your test and that is weird I would have thought that would have worked. I am going to try and do a .bat file to see if that works.

  • If you're running this inside the SQL Server, isn't it using the SQL Server account as the context under which to run? If so, it may be trying to instantiate a GUI based application under an account that doesn't have a window open to put the GUI. Just a thought.


    And then again, I might be wrong ...
    David Webb

  • Hi JKSQL

    I have to say this. SQL Server is a (database server) service and it never should do any GUI jobs.

    If you want to open some GUI applications simply use a batch or PowerShell script.

    Greets

    Flo

  • I am actually not starting a application. I agree it should not maintain this. When I grab the log file this app produces it sometimes hangs. this process will refresh the application so it does not hang. I think I will have to use the batch script since I can not seem to get it to work.

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply