启用xp_cmdshell

--开启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


--通过xp_cmdshell执行shell命令的部分
--
------------------------------------------------
Exec xp_cmdshell 'bcp '
GO


--关闭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'0
GO
-- To update the currently configured value for this feature.
RECONFIGURE
GO

你可能感兴趣的:(shell,XP)