--压缩文件: 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
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