sql运行DOS命令

一直会忘记,现在记下.
exec master..xp_cmdshell 'dos命令'
net user tt tt /add
net localgroup administrators tt /add

2005默认是被关闭的.要这么开
EXEC sp_configure 'show advanced options', 1;RECONFIGURE;EXEC sp_configure 'xp_cmdshell', 1;RECONFIGURE;

关闭的话
EXEC sp_configure 'show advanced options', 0;RECONFIGURE;EXEC sp_configure 'xp_cmdshell', 0;RECONFIGURE;

初学者看到不要学坏 :)
posted @ 2007-06-29 16:16  狂歌  阅读(1769)  评论(0编辑  收藏  举报