我想将一个目录(pscp)从 Windows 服务器复制到 Linux 服务器 Linux 服务器上的目标地名每次都必须是新的。当我运行以下命令时,
> pscp -p -l root
> -pw mypassword -r C:\ProgramFiles\Mybackups\root@linux_server:/root/mywindowsbackups/$(date)
命令替换 $(date) 不起作用。有人可以建议我如何运行它吗?
我想将一个目录(pscp)从 Windows 服务器复制到 Linux 服务器 Linux 服务器上的目标地名每次都必须是新的。当我运行以下命令时,
> pscp -p -l root
> -pw mypassword -r C:\ProgramFiles\Mybackups\root@linux_server:/root/mywindowsbackups/$(date)
命令替换 $(date) 不起作用。有人可以建议我如何运行它吗?
尝试以下操作:
:: 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%