天天看点

sql server 下使用 dos 命令

 一直会忘记,现在记下.

exec master..xp_cmdshell 'dir d:/'

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;

初学者看到不要学坏 :)