Powershell Cygwin は Rsync リモートを変数としてデータをコピーします

Powershell Cygwin は Rsync リモートを変数としてデータをコピーします

Cygwine の 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 の先頭に引用符が付いた "root@... as user" を受信するため、スクリプトの実行が停止します。

"E:\cwRsync\bin\rsync.exe" -vrts --progress --whole-file --no-compress --no-checksum -e /cygdrive/e/CWrsync/bin/ssh "[email protected]:/media/nss/rep01/Com/Com dir Soins info/" /cygdrive/g/Shares/C:\temp\Rsync --delete-before

スクリプト変数からの引用を無視するように変数を解析するにはどうすればよいですか?

答え1

私はVisual Studio Codeを使用していますが、コードはうまく動作します。PowershellのISE IDEが引用符を正しく解釈していないと思います。

関連情報