简体   繁体   中英

Copy files using Powershell

I am trying to copy files. I connected to server using RDP and find the file to copy . I need to copy that file to another remote server. All the servers i connect using vpn and those servers are in diferent network How can i do that , using either command prompt and powershell.

You can try something like this.

$SRV1 = "\\SRV1\Folder\Subfolder\File"
$SRV2 = "\\SRV2\Folder\Subfolder\File"

If ((Test-Path -Path $SRV1) -and ((Test-Path -Path $SRV2))
{
    Copy-Item -Path $SRV1 -Destination $SRV2
}

If your host server can reach both servers SRV1 et SRV2, then you should be able to copy the files from a server to another.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM