从 SQL Server 创建 zip 文件 [英] Create zip file from SQL Server

查看:52
本文介绍了从 SQL Server 创建 zip 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我用来创建带有密码的 .rar 文件的代码

Here is code which I use to create a .rar file with a password

DECLARE @source VARCHAR(1000),
        @destination VARCHAR(1000),
        @Command VARCHAR(1000)

SET @source = 'E:\Temp\testRar.txt'
SET @destination = 'E:\Temp\testRar.rar'

SET @Command = '"C:\Program Files\WinRAR\Rar.exe"  a -ep1 -pasd^ad ' +@destination+' '+@source

EXEC MASTER..xp_cmdshell @Command

但它设置了asdad 密码而不是asd^ad^ 符号被忽略.为什么?

but it sets asdad password and not asd^ad, ^ symbol is ignored. Why?

推荐答案

^ 字符是命令外壳中的转义字符.尝试加倍.

The ^ character is an escape character in the command shell. Try doubling it up.

SET @Command = '"C:\Program Files\WinRAR\Rar.exe"  a -ep1 -pasd^^ad ' +@destination+' '+@source

这篇关于从 SQL Server 创建 zip 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆