Hi, I'm trying to run an external program from within a stored procedure using xp_cmdshell. The actual software I want to run is some address cleaning software which does not require any user input to run. For testing purposes I have been trying to launch the windows calculator from within the procedure. My procedure is as follows:
CREATE PROCEDURE addressclean AS
exec master.dbo. xp_cmdshell 'c:\winnt\system32\calc.exe'
GO
When I run this, the query never finishes and I have to stop it manually. The calculator never appears on the screen although if I look in task manager the calc.exe process is running. All permissions to run xp_cmdshell are ok, I can do a dir.* from xp_cmdshell and this works OK, the problem only occurs when trying to run programs. I have also tried calling the program from within a batch file and then running the batch file from xp_cmdshell, but this produces the same results.
I have also tried setting up a scheduled job to run an external application, but when it runs this also produces the same results.
Can anyone shed any light on this? I know it should be possible to achieve this, but I'm completely stumped!!
Cheers
Paul
CREATE PROCEDURE addressclean AS
exec master.dbo. xp_cmdshell 'c:\winnt\system32\calc.exe'
GO
When I run this, the query never finishes and I have to stop it manually. The calculator never appears on the screen although if I look in task manager the calc.exe process is running. All permissions to run xp_cmdshell are ok, I can do a dir.* from xp_cmdshell and this works OK, the problem only occurs when trying to run programs. I have also tried calling the program from within a batch file and then running the batch file from xp_cmdshell, but this produces the same results.
I have also tried setting up a scheduled job to run an external application, but when it runs this also produces the same results.
Can anyone shed any light on this? I know it should be possible to achieve this, but I'm completely stumped!!
Cheers
Paul