我对塞格葡萄酒的rsync有意见。使用Powershell脚本,我试图将目录从Novell服务器传输到Windows服务器
源的路径是来自CSV文件的变量。
Function CopyRsync ([string]$source,[string]$dest){
$sourceRoot = "root@"+$source +"/"
$dest = "/cygdrive/g/Shares/" +$dest
cmd.exe /C "e:\cwRsync\bin\rsync.exe" -vrts --progress --whole-file --no-compress --no-checksum -e "/cygdrive/e/CWrsync/bin/ssh" $sourceRoot $dest --delete-before
}
$novel = 'server.domaine.local:/media/nss/rep01/Com/Com dir Soins info'
$dfs = "C:\temp\Rsync"
CopyRsync -source $novel -dest $dfs如果变量中的源路径不包含空白,则脚本正确运行,但如果路径包含空白,则变量的内容将被引号解析,脚本将停止运行,因为SSH会话接收“root @.为用户在用户根的起始处引用引号,如下所示
"E:\cwRsync\bin\rsync.exe" -vrts --progress --whole-file --no-compress --no-checksum -e /cygdrive/e/CWrsync/bin/ssh "root@server.domaine.local:/media/nss/rep01/Com/Com dir Soins info/" /cygdrive/g/Shares/C:\temp\Rsync --delete-before如何解析变量以忽略脚本变量的引号?
发布于 2022-05-05 13:50:22
我使用代码,代码运行良好。我认为Powershell的ISE IDE没有正确解释引号
https://serverfault.com/questions/1099614
复制相似问题