使用 SQL Server 过程打开批处理文件....
为此,我以打开记事本为例。并能够使用以下代码打开它:
start "c:\windows\system32" notepad.exe
--- saved as : note.bat
我尝试使用以下程序打开它:
ALTER procedure [dbo].[executebat]
as
begin
EXEC master.dbo.xp_CMDShell 'D:\ducont\note.bat'
end
xp_cmdshell
我还使用以下代码启用了该选项::
-- To allow advanced options to be changed.
EXEC sp_configure 'show advanced options', 1
GO
-- To update the currently configured value for advanced options.
RECONFIGURE
GO
-- To enable the feature.
EXEC sp_configure 'xp_cmdshell', 1
GO
-- To update the currently configured value for this feature.
RECONFIGURE
GO
但是当我尝试执行该程序时,它会不断显示
" Query Executing..."
并且没有输出!!
如果我在任何地方出错,请指导我。