0

WindowsサーバーからLinuxサーバーにディレクトリ(pscp)をコピーしたい Linuxサーバーの対象地名は毎回新しくする必要があります。以下のコマンドを実行すると、

> pscp -p -l root
> -pw mypassword -r C:\ProgramFiles\Mybackups\root@linux_server:/root/mywindowsbackups/$(date)

コマンド置換 $(date) は機能しません。誰でもこれを実行する方法を提案できますか?

4

1 に答える 1

0

次のことを試してください。

:: This is stripping the `/` and `Day of the Week` from the date
set target_date=%date:/=-%
set target_date=%target_date:* =%

:: Copying the directory to the linux server based on this system's date
pscp -p -l root
-pw mypassword -r C:\ProgramFiles\Mybackups\root@linux_server:/root/mywindowsbackups/%target_date%
于 2014-05-18T05:01:29.440 に答える