----------启用xp_cmdshell存储过程----------------------
--检查xp_cmdshell是否启动
exec master..xp_cmdshell 'dir'
go
--启动xp_cmdshell存储过程
exec sp_configure 'show advanced options',1
go
reconfigure
go
exec sp_configure 'xp_cmdshell',1
go
reconfigure
go
--关闭xp_cmdshell存储过程
reconfigure
go
exec sp_configure 'xp_cmdshell',0
go
reconfigure
go
exec sp_configure 'show advanced options',0
go