SQLServer 开启cmd命令

参考地址
https://www.cnblogs.com/OliverQin/p/5032014.html

 

shell是用户与操作系统对话的一个接口,通过shell告诉操作系统让系统执行我们的指令

xp_cmdshell在sqlserver中默认是关闭的存在安全隐患。

--打开xp_cmdshell
 EXEC sp_configure 'show advanced options', 1;RECONFIGURE;EXEC sp_configure 'xp_cmdshell', 1;RECONFIGURE;
--关闭xp_cmdshell
EXEC sp_configure 'show advanced options', 1;RECONFIGURE;EXEC sp_configure 'xp_cmdshell', 0;RECONFIGURE;

以下是跟xp_cmdshell有关的小例子。

1.显示C盘下的内容,这个比较简单

 exec xp_cmdshell 'dir c:\'  
上一篇:双向绑定的echarts


下一篇:js 数据类型的判断