powershell UT3重复配置文件清理

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了powershell UT3重复配置文件清理相关的知识,希望对你有一定的参考价值。

Add-Type -AssemblyName Microsoft.VisualBasic
Clear
$UT3UserDir = "$($env:USERPROFILE)\Documents\My Games\Unreal Tournament 3"
$UT3ConfigDir = "$($UT3UserDir)\UTGame\Config"
$UTConfigurationFileNames = Get-ChildItem -Path "$($UT3ConfigDir)\UT*.ini"
$UTConfigurationFileDuplicates = Get-ChildItem $UT3UserDir -Recurse | ? {$_.Directory.FullName -ne $UT3ConfigDir} | ? {$UTConfigurationFileNames.Name -contains $_.Name}
if ($UTConfigurationFileDuplicates) {
	foreach ($UTConfigurationFileDuplicate In $UTConfigurationFileDuplicates) {
		$FullName = $UTConfigurationFileDuplicate.FullName
		try {
			[Microsoft.VisualBasic.FileIO.FileSystem]::DeleteFile($FullName, 'OnlyErrorDialogs', 'SendToRecycleBin')
			Write-Host "`"$($FullName)`" moved to Recycle Bin"
		} catch {
			Write-Host "`"$($FullName)`" could not be moved to Recycle Bin"
		}
	}
} else {
	Write-Host "No duplicate configuration files found."
}

以上是关于powershell UT3重复配置文件清理的主要内容,如果未能解决你的问题,请参考以下文章

powershell 文件夹清理

powershell 清理bin调试文件夹

powershell [删除包,bin和obj文件夹删除包,bin和obj资料夹]用来快速清理解决方案里面非必要档案减少空间#powershell

如何使用 Powershell 配置新的 DCOM RunAs 用户 [重复]

利用 Powershell 编写简单的浏览器脚本

powershell 清理Imsim安装(Windows)