gdjlc

培养良好的习惯,每天一点一滴的进步,终将会有收获。

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
--压缩文件: a 压缩,-ep 从名称中排除路径
declare	@sql nvarchar(200)
set @sql = '"D:\Program Files\WinRAR\WinRAR.exe" a -ep F:\a.rar F:\a.txt'
exec master..xp_cmdshell @sql

--解压文件: e 解压,-o+ 覆盖
declare	@sql nvarchar(200)
set @sql = '"D:\Program Files\WinRAR\WinRAR.exe" e -o+ F:\a.rar F:\'
exec master..xp_cmdshell @sql

--解压文件: e 压缩, -o-跳过,-inul 禁止所有消息。
declare	@sql nvarchar(200)
set @sql = '"D:\Program Files\WinRAR\WinRAR.exe" e -o- -inul F:\a.rar F:\'
exec master..xp_cmdshell @sql



---附:
---xp_cmdshell的启用、禁用
-- To allow advanced options to be changed.
EXEC sp_configure 'show advanced options', 1
GO
-- To update the currently configured value for advanced options.
RECONFIGURE
GO
-- To enable the feature.
EXEC sp_configure 'xp_cmdshell', 1 --1为启用,0为禁用
GO
-- To update the currently configured value for this feature.
RECONFIGURE
GO

 

posted on 2011-11-05 14:24  gdjlc  阅读(1370)  评论(0编辑  收藏  举报