exec sp_configure 'show advanced options', 1;
reconfigure
exec sp_configure 'xp_cmdshell', 1;
reconfigure
exec sp_configure 'xp_cmdshell', 0;
reconfigure
exec master.dbo.xp_cmdshell 'echo abc > D:\share\test.txt'
exec master.dbo.xp_cmdshell 'echo abc >> D:\share\test.txt'
exec master.dbo.xp_cmdshell 'type D:\share\test.txt'
exec master.dbo.xp_cmdshell 'copy D:\test\test.txt D:\share\'
--显示目录
exec master.dbo.xp_cmdshell 'dir D:\share\'
exec master.dbo.xp_cmdshell 'md D:\share\test\'
--删除目录
exec master.dbo.xp_cmdshell 'rd D:\share\test'
--删除文件
exec master.dbo.xp_cmdshell 'del D:\share\test.txt'
--重命名文件
exec master.dbo.xp_cmdshell 'ren D:\test\test.txt new.txt'
--移动文件
exec master.dbo.xp_cmdshell 'move D:\test\new.txt D:\share\'
exec master.dbo.xp_cmdshell 'cd D:\share\'