powershell - Powershell - 你能根据公司删除项目吗
问题描述
您可以使用命令 Remove-Item 根据“公司”字段进行删除吗?它是 windows 拥有的字段之一,我想基本上删除具有以下值之一的所有内容
$company = "Sage (UK) Limited","Sage (UK) Ltd","Sage","The Sage Group plc","SAGE Software Ltd"
这可能吗?
解决方案
$path = 'C:\'
$company = 'Sage (UK) Limited','Sage (UK) Ltd','Sage','The Sage Group plc','SAGE Software Ltd'
Remove-Item (Get-ChildItem $path | Where-Object {$company.Contains($_.VersionInfo.CompanyName)}).FullName
这个灵魂的工作。替换$path
为您要检查的文件夹路径
推荐阅读
- php - 尝试使用 foreach 循环使用 MYSQL 选择一行数据
- python - 我无法在 python 中使用遗传算法得到正确答案
- performance - FastReport paperSize not taking any effect on changing width and height of the ReportPage
- python - 如何使用名称和值对列表 Python 中的列表中的列表进行排序?
- typescript - TypeScript 函数重载
- swift - 在 Swift 中以编程方式将富文本转换为纯文本
- javascript - 如何在 Vue 中禁止 v-model 输入发生变异
- javascript - 如何在 twilio studio 中允许暂停收集输入
- routing - OpenVPN无法上网
- watson-studio - 在 Watson Studio 中使用 Google Vectors