手机
当前位置:查字典教程网 >脚本专栏 >PowerShell >Powershell比较两个文件夹的不同
Powershell比较两个文件夹的不同
摘要:快速找出两个文件夹中不同的部分,可以使用下面例子:复制代码代码如下:$list1=Get-ChildItemc:Windowssystem3...

快速找出两个文件夹中不同的部分,可以使用下面例子:

复制代码 代码如下:

$list1 = Get-ChildItem c:Windowssystem32 | Sort-Object -Property Name

$list2 = Get-ChildItem server12c$windowssystem32 | Sort-Object -Property Name

Compare-Object -ReferenceObject $list1 -DifferenceObject $list2 -Property Name |

Sort-Object -Property Name

首先,脚本得到两个不同列表变量,一个来自本地,一个来自远程电脑,接着Compare-Object将从中分析出两边的不同处。

【Powershell比较两个文件夹的不同】相关文章:

PowerShell脚本性能优化技巧总结

PowerShell中的变量基础知识介绍

PowerShell ISE中代码转换大小写的技巧

探索PowerShell(十一)函数介绍

Powershell获取系统中所有可停止的服务

Windows Powershell 变量的作用域

Powershell小技巧之删除不规则字符

PowerShell函数中的开关参数介绍和创建实例

PowerShell中读取多行文本示例

PowerShell中prompt函数的妙用

精品推荐
分类导航