从批处理文件或 windows 命令行复制文件并放入 zip 文件
Copy files and put into zip file from batch file or windows command line
如何从本地网络中的另一台计算机复制文件并将它们另存为本地计算机中的 zip 文件?
有没有办法直接使用 xcopy、robocopy 或类似程序来压缩文件?
从Powershell角度回答:
V5 之前的 Powershell 有多种压缩文件的实现,在 V5 中有一个 cmdlet compress-archive
。
Here 您可以找到与您的问题类似的 link(本地来源,unc dest),但反过来应该也一样。
如果两台电脑都安装了powershell就可以直接执行下面的代码
Legit credentials = new credentials.
$s = New-PSSession -ComputerName RemotePc -Credential LegitCredentials
Invoke-Command -Session $s -ScriptBlock
{
Add-Type -assembly "system.io.compression.filesystem"
[io.compression.zipfile]::CreateFromDirectory($SourcePath,$destinationPath)
Move-item from $destinationPath to sharedPath
Move-item from sharedpath to localpath
}
如何从本地网络中的另一台计算机复制文件并将它们另存为本地计算机中的 zip 文件? 有没有办法直接使用 xcopy、robocopy 或类似程序来压缩文件?
从Powershell角度回答:
V5 之前的 Powershell 有多种压缩文件的实现,在 V5 中有一个 cmdlet compress-archive
。
Here 您可以找到与您的问题类似的 link(本地来源,unc dest),但反过来应该也一样。
如果两台电脑都安装了powershell就可以直接执行下面的代码
Legit credentials = new credentials.
$s = New-PSSession -ComputerName RemotePc -Credential LegitCredentials
Invoke-Command -Session $s -ScriptBlock
{
Add-Type -assembly "system.io.compression.filesystem"
[io.compression.zipfile]::CreateFromDirectory($SourcePath,$destinationPath)
Move-item from $destinationPath to sharedPath
Move-item from sharedpath to localpath
}