注册 登录
编程论坛 SQL Server论坛

貌似很弱智的问题

gxwxgxwx 发布于 2013-08-06 19:10, 699 次点击
在纯sql2008环境下,能在硬盘里新建文件夹吗??先谢了
2 回复
#2
love云彩2013-08-06 21:57
为什么不试一试?不试过怎么知道?这种问题是重在尝试
#3
gxwxgxwx2013-08-07 08:00

终于被我找到了,谢谢楼上兄弟的鼓励!
EXEC sp_configure 'show advanced options', 1
GO
RECONFIGURE
GO
EXEC sp_configure 'xp_cmdshell', 1
go
RECONFIGURE
GO

EXEC sp_configure 'show advanced options', 0
GO
RECONFIGURE
GO

EXEC master..xp_cmdshell 'if not exist D:\abc (md D:\abc)'--新建文件夹

EXEC master..xp_cmdshell 'if exist D:\abc (del /q D:\abc)'--删除文件

EXEC master..xp_cmdshell 'if exist D:\abc (rd /q D:\abc)'--删除文件夹

Go
EXEC sp_configure 'show advanced options', 1
GO
RECONFIGURE
GO

EXEC sp_configure 'xp_cmdshell', 0
go
RECONFIGURE
GO

EXEC sp_configure 'show advanced options', 0
GO
RECONFIGURE
GO
1