Win 11 & 10 최적화 설정
C 드라이브의 임시 파일을 삭제하는 방법
홍차의 꿈
2026. 3. 1. 00:11
728x90
728x170
임시 쓰레기 파일을 삭제하는 파워쉘 스크립트입니다.
파워쉘 코드를 메모장으로 열어서 드라이브 문자만 바꿔주면 다른 드라이브도 가능합니다.
# C 드라이브의 임시 파일을 삭제
Write-Host "작업 진행중..." -ForegroundColor Green
$ext = @(".bak",".blg",".cache",".chk",".crdownload",".dmp",".download",".err",".etl",".evtx",".hdmp",".installlog",".log",".mdmp",".mrtlog",".old",".out",".part",".partial",".pid",".rpt",".stackdump",".swp",".temp",".tmp",".tmpdownload",".trace",".webcache",".wer")
$files = Get-ChildItem "C:\" -Recurse -File -Force -ErrorAction SilentlyContinue |
Where-Object { $ext -contains $_.Extension.ToLower() }
Write-Host "찾은 파일 수: $($files.Count)" -ForegroundColor Cyan
$files | Remove-Item -Force -Confirm:$false -ErrorAction SilentlyContinue
Write-Host "삭제 완료" -ForegroundColor Yellow
Write-Host ""
pause
# D 드라이브의 임시 파일을 삭제
Write-Host "작업 진행중..." -ForegroundColor Green
$ext = @(".bak",".blg",".cache",".chk",".crdownload",".dmp",".download",".err",".etl",".evtx",".hdmp",".installlog",".log",".mdmp",".mrtlog",".old",".out",".part",".partial",".pid",".rpt",".stackdump",".swp",".temp",".tmp",".tmpdownload",".trace",".webcache",".wer")
$files = Get-ChildItem "D:\" -Recurse -File -Force -ErrorAction SilentlyContinue |
Where-Object { $ext -contains $_.Extension.ToLower() }
Write-Host "찾은 파일 수: $($files.Count)" -ForegroundColor Cyan
$files | Remove-Item -Force -Confirm:$false -ErrorAction SilentlyContinue
Write-Host "삭제 완료" -ForegroundColor Yellow
Write-Host ""
pause
Clean-WindowsTemp_Folder.ps1
0.00MB
# ===============================
# Windows 11 쓰레기 자동 정리 스크립트
# ===============================
# 관리자 권한 체크
if (-not ([bool]([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))) {
Write-Host "관리자 권한으로 실행하세요!" -ForegroundColor Red
exit
}
# 정리 대상 폴더 목록
$folders = @(
"$env:windir\Temp",
"$env:LOCALAPPDATA\Temp",
"$env:windir\SoftwareDistribution\Download",
"$env:LOCALAPPDATA\Microsoft\Windows\INetCache",
"$env:ProgramData\Microsoft\Windows\WER",
"$env:LOCALAPPDATA\Microsoft\Windows\Explorer",
"$env:windir\Prefetch",
"$env:LOCALAPPDATA\Packages\*\AC",
"$env:windir\Logs",
"$env:windir\Logs\CBS",
"$env:windir\SoftwareDistribution\Datastore\Logs"
)
# 정리 대상 확장자
$ext = @("*.tmp","*.temp","*.bak","*.log","*.cache","*.dmp","*.mdmp","*.hdmp","*.swp","*.crdownload","*.partial")
Write-Host "Windows 11 쓰레기 파일 정리 시작..." -ForegroundColor Yellow
foreach ($folder in $folders) {
Write-Host "`n[정리중] $folder" -ForegroundColor Cyan
try {
# 하위 폴더와 파일 검색
Get-ChildItem $folder -Recurse -Force -ErrorAction SilentlyContinue |
Where-Object { $_.PSIsContainer -eq $false -and $ext -contains "*$($_.Extension)" } |
Remove-Item -Force -Confirm:$false -ErrorAction SilentlyContinue
}
catch {
Write-Host "오류 발생: $($_.Exception.Message)" -ForegroundColor Red
}
}
Write-Host "`n정리 완료!" -ForegroundColor Green
Read-Host "엔터를 누르면 종료됩니다"
반응형
300x250


반응형
그리드형(광고전용)