--说明:首先要将RAR以及UNRAR复制到system32下,或者设计环境变量
/*
declare @t nvarchar(256)
EXEC p_cmd_unrar_copy 'D:\xxxx.rar','D:',@t output
select @t
*/
Create proc p_cmd_unrar_copy
(
@fullfilepath nvarchar(256),--要解压的RAR文件
@tofilepath nvarchar(256),--要复制到的文件夹(不加\)
@filetime nvarchar(256) output,--输出解压的文件夹的时间及大小以及文件名,不截取时间了
@iscopychildCover bit=1--是否复制子目录并覆盖
)
as
set nocount on
declare @isok int,@childfile nvarchar(256)
set @isok=-1;
if isnull(@fullfilepath,'')='' or isnull(@tofilepath,'')=''
begin
select '输入不正确'
return @isok;
end
else
begin
declare @r int
exec master..xp_fileexist @fullfilepath,@r output
if @r=0
begin
select @fullfilepath+'文件不存在!'
return @isok
end
if OBJECT_ID('tempdb..#tofilepath') is not null
drop table #tofilepath
create table #tofilepath(col nvar
SQL利用CMD及RAR命令实现将某一压缩文件解压到指定的路径
最新推荐文章于 2024-07-08 23:29:56 发布