将文件从网络共享复制到远程 PC 的硬盘

Copy a file from a network share to a remote PC`s harddisk

我有这个测试设置:

# Attach a network drive to X
net use X: \MySharename\Exchange /user:MyUser MyPassword

# copy test.txt file from share to a remote computer D (Dev)
copy X:\test.txt MyComputerNameOrIP\D:\

如何在语法上正确编写目标系统"MyComputerNameOrIP\D:\"

我想copy/paste共享X中的test.txt文件到另一台电脑的硬盘D:\

更新

net use X: /delete

# Attach a network drive to X:
net use X: \MyShare\Exchange /user:myuser mypass

# copy test.txt file from share to a remote computer D (Dev)
Copy-Item -Path X:\test.txt '\MyComputername\D$'

然后我得到错误:"Copy-Item : The network path was not found."

][Step 5/5] X: was deleted successfully.

[12:59:36][Step 5/5] 

[12:59:36][Step 5/5] The command completed successfully.

[12:59:36][Step 5/5] 

[13:00:19][Step 5/5] Copy-Item : The network path was not found.

[13:00:19][Step 5/5] At C:\TeamCity\buildAgent\temp\buildTmp\powershell1776282632632814927.ps1:7 

[13:00:19][Step 5/5] char:1

[13:00:19][Step 5/5] + Copy-Item -Path X:\test.txt '\MyComputername\D$'

[13:00:19][Step 5/5] + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[13:00:19][Step 5/5]     + CategoryInfo          : NotSpecified: (:) [Copy-Item], IOException

[13:00:19][Step 5/5]     + FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Comma 

[13:00:19][Step 5/5]    nds.CopyItemCommand

[13:00:19][Step 5/5] 

计算机名当然是为了SO...

你可以这样做: Copy-Item -Path X:\Test.txt '\MyComputerNameOrIP\D$'