An open API service indexing awesome lists of open source software.

https://github.com/dovahkiinyuzuko/wincacheremover

[ENG] Safe and efficient Windows cache & temporary file cleaner for all users (Bilingual Support) / [JPN] 全ユーザー対応のWindowsキャッシュ・一時ファイル削除ツール(日英バイリンガル対応)。
https://github.com/dovahkiinyuzuko/wincacheremover

automation bilingual cache-cleaner cleanup powershell windows

Last synced: about 2 hours ago
JSON representation

[ENG] Safe and efficient Windows cache & temporary file cleaner for all users (Bilingual Support) / [JPN] 全ユーザー対応のWindowsキャッシュ・一時ファイル削除ツール(日英バイリンガル対応)。

Awesome Lists containing this project

README

          

# WinCacheRemover

![PowerShell](https://img.shields.io/badge/PowerShell-5391FE?style=for-the-badge&logo=powershell&logoColor=white)
![License](https://img.shields.io/badge/license-MIT-blue?style=for-the-badge)

**Windows Cache & Temp File Cleaner / Windows キャッシュ・一時ファイル削除ツール**

Windowsシステムおよび全ユーザーのキャッシュ・一時ファイルを安全かつ効率的に削除する、PowerShellベースのコマンドラインツールです。
A PowerShell-based command line tool to safely and efficiently delete cache and temporary files for the Windows system and all users.

---

[日本語](#日本語) | [English](#english)

---

## 日本語

### 概要
WinCacheRemoverは、Windows OSや各種アプリケーションが生成する不要なキャッシュファイルを一括でクリーンアップします。特に、マルチユーザー環境において全ユーザーの `Temp` フォルダ等をスキャンし、一定期間(デフォルトは3日)以上経過した古いファイルのみを安全に削除します。

### 特徴
- **マルチユーザー対応**: `C:\Users` 以下の全ユーザープロファイルを自動的に検出し、各ユーザーのキャッシュをクリーンアップします。
- **安全性重視**:
- NTFSジャンクションやシンボリックリンクを自動的に検知し、リンク先(システムディレクトリ等)への意図しない波及を防止します。
- 使用中のファイルは自動的にスキップされ、スクリプトが停止することはありません。
- **日英バイリンガル**: コンソール出力および設定ファイルは日本語と英語を併記しています。
- **自動実行対応**: 実行間隔(デフォルトは7日)を制限する機能を備えており、タスクスケジューラでの定期実行に適しています。
- **詳細なログ**: 実行結果や削除されたファイルの合計サイズ、エラー内容がログファイルに詳細に記録されます。

### 使用方法
1. 管理者権限でPowerShellを起動します。
2. スクリプトを実行します:
```powershell
.\WinCacheRemover.ps1
```
3. 初回実行時、または設定を変更したい場合は `config.txt` を編集してください。

### 設定項目 (config.txt) 詳細
各項目は `Key=Value` の形式で指定します。

* `ExecutionIntervalDays`: スクリプトを実行する最小間隔(日)。(デフォルト: 7)
* `MinFileAgeDays`: 削除対象とするファイルの最小経過日数。(デフォルト: 3)
* `LogDirectory`: ログファイルを保存するディレクトリ。(デフォルト: スクリプトと同じ場所)
* `LogRetentionDays`: ログファイルの保持期間(日)。(デフォルト: 30)
* `Delete_UserTemp`: ユーザーのTempフォルダを削除。(デフォルト: true)
* `Delete_SystemTemp`: システムのTempフォルダ (`C:\Windows\Temp`) を削除。(デフォルト: true)
* `Delete_InetCache`: IE/Edgeのインターネットキャッシュを削除。(デフォルト: true)
* `Delete_WebCache`: Webキャッシュを削除。(デフォルト: true)
* `Delete_CrashDumps`: アプリのクラッシュダンプを削除。(デフォルト: true)
* `Delete_UWP_LocalCache`: Microsoft Storeアプリのローカルキャッシュを削除。(デフォルト: true)
* `Delete_UWP_TempState`: Microsoft Storeアプリの一時状態を削除。(デフォルト: true)
* `Delete_WindowsUpdateCache`: Windows Updateのダウンロードキャッシュを削除。※アップデート中に削除すると不具合の原因になるためデフォルトは `false` です。
* `Delete_Prefetch`: Prefetch(アプリ起動高速化データ)を削除。※削除すると一時的にアプリの起動が遅くなるためデフォルトは `false` です。

#### おすすめの設定例 (config.txt)
**1. 安全・標準重視(おすすめ)**
システムの安定性とアプリの起動速度を優先しつつ、安全にキャッシュを掃除します。
```text
ExecutionIntervalDays=7
MinFileAgeDays=3
Delete_WindowsUpdateCache=false
Delete_Prefetch=false
```

**2. ストレージ容量最優先(アグレッシブ)**
とにかく空き容量を確保したい場合の設定です。
```text
ExecutionIntervalDays=3
MinFileAgeDays=1
Delete_WindowsUpdateCache=true
Delete_Prefetch=true
```

---

## English

### Overview
WinCacheRemover is a utility designed to clean up unnecessary cache and temporary files generated by the Windows OS and various applications. It scans temporary folders across all user profiles in multi-user environments and safely deletes files older than a specified threshold (default: 3 days).

### Key Features
- **Multi-User Support**: Automatically detects all user profiles under `C:\Users` and cleans their respective caches.
- **Safety First**:
- Protects against accidental deletion of system files by explicitly skipping NTFS Junctions and Symbolic Links.
- Automatically skips files currently in use, ensuring continuous operation without manual intervention.
- **Bilingual Support**: All console messages and the configuration file are provided in both Japanese and English.
- **Automation Ready**: Includes a built-in execution interval check (default: 7 days), making it ideal for scheduled tasks.
- **Detailed Logging**: Logs execution summaries, including the total space freed and any errors encountered.

### How to Use
1. Open PowerShell as an Administrator.
2. Run the script:
```powershell
.\WinCacheRemover.ps1
```
3. Edit `config.txt` to customize settings or change the cleanup behavior.

### Configuration Details (config.txt)
Specify each item in the format `Key=Value`.

* `ExecutionIntervalDays`: Minimum days required between executions. (Default: 7)
* `MinFileAgeDays`: Minimum age (in days) of files to be considered for deletion. (Default: 3)
* `LogDirectory`: The path where log files will be saved. (Default: Script directory)
* `LogRetentionDays`: Number of days to keep old log files. (Default: 30)
* `Delete_UserTemp`: Delete user Temp folders. (Default: true)
* `Delete_SystemTemp`: Delete the system Temp folder (`C:\Windows\Temp`). (Default: true)
* `Delete_InetCache`: Delete IE/Edge internet cache. (Default: true)
* `Delete_WebCache`: Delete Web cache. (Default: true)
* `Delete_CrashDumps`: Delete application crash dumps. (Default: true)
* `Delete_UWP_LocalCache`: Delete Microsoft Store apps local cache. (Default: true)
* `Delete_UWP_TempState`: Delete Microsoft Store apps temporary state. (Default: true)
* `Delete_WindowsUpdateCache`: Delete Windows Update download cache. *Default is `false` to prevent interference with active updates.*
* `Delete_Prefetch`: Delete Prefetch data (used to speed up app launches). *Default is `false` to preserve app launch performance.*

#### Recommended Configuration Examples (config.txt)
**1. Safe & Standard (Recommended)**
Prioritizes system stability and app launch speed while safely cleaning caches.
```text
ExecutionIntervalDays=7
MinFileAgeDays=3
Delete_WindowsUpdateCache=false
Delete_Prefetch=false
```

**2. Storage Capacity First (Aggressive)**
Use this if you need to free up as much disk space as possible.
```text
ExecutionIntervalDays=3
MinFileAgeDays=1
Delete_WindowsUpdateCache=true
Delete_Prefetch=true
```

---

## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.