A lightweight, open-source Windows desktop utility built with Electron and Node.js that automatically cleans temporary files from your system. Designed for simplicity, speed, and reliability — no GUI window, no unnecessary overhead. The application runs a batch script silently through a terminal window and exits immediately after completion.
- Overview
- Features
- Tech Stack
- Project Structure
- Prerequisites
- Installation
- Usage
- Build
- How It Works
- Security & Permissions
- Contributing
- License
- Author
Clean Temp Files is a minimal Windows desktop application that targets and removes junk from two key system directories:
%TEMP%— the current user's temporary files folderC:\Windows\Temp— the system-wide Windows temporary files folder
These directories accumulate cache, logs, install artifacts, and other disposable files over time, consuming significant disk space. This tool provides a one-click solution to reclaim that space safely, ignoring any files that are currently locked or in use by the operating system.
- Cleans user-level temp directory (
%TEMP%) including all subdirectories - Cleans system-level temp directory (
C:\Windows\Temp) - Silently skips locked or in-use files without crashing or prompting
- No GUI window — launches a terminal (CMD) window showing real-time progress
- Automatically exits after cleanup is complete
- Packaged as a native Windows
.exeinstaller via NSIS - Requests Administrator privileges at launch to ensure full access
- Hardware acceleration disabled for minimal resource usage
| Technology | Version | Purpose |
|---|---|---|
| Electron | ^29.0.0 | Desktop application framework |
| Node.js | v18+ | Runtime environment & file system operations |
| electron-builder | ^24.9.1 | Packaging, installer generation (.exe) |
| Windows Batch | Built-in | Temp file deletion script |
| NSIS | Built-in | Windows installer system |
clean-temp-files/
│
├── assets/
│ └── icon.ico # Application icon (used in installer & taskbar)
│
├── dist/ # Build output directory (auto-generated)
│
├── main.js # Electron main process — writes & executes .bat script
├── preload.js # Preload script — context bridge setup (IPC ready)
├── package.json # Project metadata, scripts, and electron-builder config
├── package-lock.json # Locked dependency tree
├── .gitignore # Git ignore rules
└── README.md # Project documentation
Before running or building this project, ensure the following are installed on your system:
- Node.js v18.0.0 or higher — Download here
- npm v9.0.0 or higher (bundled with Node.js)
- Windows operating system (10 or 11, 64-bit recommended)
- Administrator access on the machine
To verify your setup:
node --version
npm --version1. Clone the repository:
git clone https://github.com/helloanaroul/clean-temp-files.git2. Navigate into the project directory:
cd clean-temp-files3. Install all dependencies:
npm installLaunches the Electron app directly from source without packaging:
npm startNote: When running in development, Windows may prompt for Administrator privileges. Allow it for full functionality.
Produces a standard Windows installer (.exe) with install/uninstall support, desktop shortcut, and Start Menu entry:
npm run buildOutput: dist/Clean Temp Files Setup 1.0.0.exe
Produces a single standalone .exe that requires no installation:
npm run build-portableOutput: dist/Clean Temp Files 1.0.0.exe
| Setting | Value |
|---|---|
| App ID | com.cleantemp.app |
| Product Name | Clean Temp Files |
| Target Platform | Windows x64 |
| Installer Type | NSIS |
| One-Click Install | Disabled (user chooses path) |
| Desktop Shortcut | Created |
| Start Menu Shortcut | Created |
| Execution Level | requireAdministrator |
When the application is launched, the following sequence occurs:
- Electron starts —
main.jsis executed as the main process. - Batch script is generated — A
.batscript (clean_temp_runner.bat) is dynamically written to the system's temp directory usingfs.writeFileSync. - CMD window is spawned — The script is executed via
cmd.exeusing Node.jschild_process.spawn, opening a visible terminal window that displays progress messages. - Cleanup runs — The batch script deletes all files and subdirectories inside
%TEMP%andC:\Windows\Temp, suppressing errors for locked files (>nul 2>&1). - Electron quits — After a 500ms delay,
app.quit()is called and the Electron process exits, leaving only the CMD window open until the batch script finishes.
The package.json build configuration sets requestedExecutionLevel to requireAdministrator. This means Windows will display a UAC (User Account Control) prompt when the application is launched, requesting elevated permissions.
This is required to:
- Access and delete files in
C:\Windows\Temp - Remove files that standard users cannot delete
The preload.js file uses Electron's contextBridge to expose a safe API (electronAPI) to the renderer process, maintaining proper context isolation between the main and renderer processes as per Electron security best practices.
Contributions are welcome. To contribute:
- Fork the repository
- Create a new feature branch (
git checkout -b feature/your-feature-name) - Commit your changes (
git commit -m "Add: your feature description") - Push to the branch (
git push origin feature/your-feature-name) - Open a Pull Request
Please ensure your code is clean, well-commented, and tested on Windows before submitting.
This project is licensed under the MIT License. You are free to use, modify, and distribute this software for personal or commercial purposes, provided the original license and copyright notice are included.
Md. Anarul Sarder GitHub: @helloanaroul
Built with Electron and Node.js — Designed for Windows.