Microsoft KB Archive/323411

= INF: Programs Run Through Xp_cmdshell Have No User Interface =

Article ID: 323411

Article Last Modified on 6/22/2006

-

APPLIES TO


 * Microsoft SQL Server 2000 Standard Edition
 * Microsoft SQL Server 6.5 Standard Edition
 * Microsoft SQL Server 7.0 Standard Edition

-



This article was previously published under Q323411





SUMMARY
If you run a program through the xp_cmdshell extended stored procedure, the program only runs in the background. The xp_cmdshell extended stored procedure does not display the user interface of the programs that run in its context. If an application that is run through xp_cmdshell does needs user interaction from a user interface (for example, the application tries to create a dialog box or a message box that needs user input) it will stop responding because it is waiting for input. However, xp_cmdshell will never display the user interface; therefore, the user cannot provide any input.



MORE INFORMATION
The xp_cmdshell stored procedure is typically included in SQL scripts to run operating system commands. It is not designed to start applications that have a user interface that interact with a user.

If you use xp_cmdshell to start an application (for example, Notepad) that has a user interface, xp_cmdshell will start your application, pass the control to your application, and then wait indefinitely until it ends. Because you cannot close such an application interactively while it is running in the background, xp_cmdshell never regains control from your application.

For xp_cmdshell to regain control, you may have to kill the corresponding process of your application manually with Task Manager. Note that you must continue with caution when you end a process. If you quit a program in this manner, data that has not been saved will be lost. If you end a system process, a system component may no longer function properly.