linux - 将 pscp 文件从 Windows 服务器复制到远程 Linux 服务器

标签 linux windows batch-file pscp

我想将一个目录(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%

关于linux - 将 pscp 文件从 Windows 服务器复制到远程 Linux 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23718266/

相关文章:

batch-file - 批处理文件 : file mask

c++ - Linux:从给定的源文件自动创建 C++ makefile

linux - 如何显示包含在C/C++共享库中的头文件和src文件的名称

windows - 如何处理来自单独线程的窗口消息?

c++ - 如何获取身份验证类型(如 WindowsIdentity.AuthenticationType 属性)

windows - 如何创建启动 Cygwin 并跟踪特定文件的桌面快捷方式?

linux - Alpine Linux "--update add"命令的解释

linux - xterm 中 vim 的功能键

c++ - QProgressDialog::setValue 产生随机堆栈溢出

windows - 将 Linux 目录与 Windows 网络路径同步