用于压缩用户主文件夹并将其移动到共享驱动器的 Powershell 脚本

Powershell script to zip users home folder and move it to share drive

我想移动用户主文件夹以共享已离开公司的驱动器,但在此之前我想 ZIP 使用 powershell script。您能否给我建议或快速写信给我 powershell script 哪个 ZIPs 文件夹并移动到共享驱动器,在目标文件夹中创建一个与 zip 文件名称相同的文件夹名称。例如,如果源文件夹是 C:\test 并且目标文件夹是 is \share\test\

提前致谢,

有几种压缩文件夹的方法:
Creating a zipped/compressed folder in Windows using Powershell or the command line

创建新文件夹很简单:

New-Item c:\folder -type directory

https://technet.microsoft.com/en-us/library/ee176914.aspx

移动文件也很简单:

Move-Item c:\source\file.zip c:\destination

https://technet.microsoft.com/en-us/library/ee176914.aspx