Skip to content

Conversation

@inode64
Copy link
Owner

@inode64 inode64 commented Sep 8, 2025

Summary

  • add NSIS script to create a single-file GUI installer that copies DriveClean.ps1, launches Disk Cleanup for configuration, and optionally registers a scheduled task
  • document new NSIS installer workflow in README
  • remove legacy PowerShell installer script
  • add GitHub Actions workflow to build and upload NSIS installer

Testing

  • makensis WindowsClearCache.nsi
  • pwsh -NoProfile -Command "Get-Command -Name ./DriveClean.ps1" (fails: command not found)
  • apt-get install -y powershell (fails: Unable to locate package powershell)

https://chatgpt.com/codex/tasks/task_e_68bf02627024832e818798e3d28e7b4e

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @inode64, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the user experience for the WindowsClearCache tool by transitioning from a manual PowerShell-based setup to a user-friendly, automated graphical installer. The change streamlines the deployment and initial configuration, making the tool more accessible and easier to manage for end-users.

Highlights

  • New NSIS Installer: Introduces a new NSIS (Nullsoft Scriptable Install System) script to create a graphical installer (WindowsClearCacheInstaller.exe) for the DriveClean.ps1 script.
  • Automated Setup: The new installer automates the setup process, including copying the PowerShell script, launching Disk Cleanup for initial configuration, and providing an option to create a weekly scheduled task for automated cleanup.
  • Documentation Update: The README.md has been updated to reflect the simplified installation and execution workflow using the new NSIS installer, replacing the previous manual PowerShell instructions.
  • Build Artifact Exclusion: A .gitignore entry has been added to exclude the generated WindowsClearCacheInstaller.exe from version control.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request is a great step forward, introducing an NSIS installer to simplify the setup process for users. The documentation has also been updated accordingly. My review includes a few suggestions to enhance the robustness and completeness of the installer. Specifically, I've identified an issue with command argument quoting in the NSIS script and noted the absence of an uninstaller, which is a critical feature for installers. Additionally, I've recommended minor improvements to the README to make the instructions more generic and reliable across different system configurations.

nsExec::ExecToLog 'cleanmgr.exe /sageset:1'

MessageBox MB_YESNO "Create a weekly scheduled cleanup task?" IDNO SkipTask
nsExec::ExecToLog 'schtasks /Create /TN "WindowsClearCache" /TR "powershell.exe -ExecutionPolicy Bypass -File \\\"$INSTDIR\\DriveClean.ps1\\\"" /SC WEEKLY /RL HIGHEST /F'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The quoting for the file path in the schtasks command appears to be incorrect. The \\\" will likely result in a literal \\" being passed in the command, which will cause the scheduled task to fail. For schtasks, inner quotes within the /TR argument should be escaped with a single backslash (\").

  nsExec::ExecToLog 'schtasks /Create /TN "WindowsClearCache" /TR "powershell.exe -ExecutionPolicy Bypass -File \"$INSTDIR\\DriveClean.ps1\"" /SC WEEKLY /RL HIGHEST /F'

Comment on lines 1 to 23
!include "MUI2.nsh"

Name "Windows Clear Cache"
OutFile "WindowsClearCacheInstaller.exe"
InstallDir "$PROGRAMFILES\\WindowsClearCache"
RequestExecutionLevel admin

!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"

Section "Install"
SetOutPath "$INSTDIR"
File "DriveClean.ps1"

DetailPrint "Open Disk Cleanup configuration"
nsExec::ExecToLog 'cleanmgr.exe /sageset:1'

MessageBox MB_YESNO "Create a weekly scheduled cleanup task?" IDNO SkipTask
nsExec::ExecToLog 'schtasks /Create /TN "WindowsClearCache" /TR "powershell.exe -ExecutionPolicy Bypass -File \\\"$INSTDIR\\DriveClean.ps1\\\"" /SC WEEKLY /RL HIGHEST /F'
SkipTask:
SectionEnd
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The installer script creates files and a scheduled task but lacks an uninstaller. This is problematic as it leaves files and system configuration (the scheduled task) on the user's machine with no easy way to remove them. It's standard practice for installers to provide an uninstallation routine.

You should add an Uninstall section and the necessary logic to register it. An uninstaller should:

  1. Be written to the installation directory (e.g., WriteUninstaller "$INSTDIR\uninstall.exe").
  2. Be registered in the Windows "Add/Remove Programs" list.
  3. Contain logic to delete the scheduled task (e.g., schtasks /Delete /TN "WindowsClearCache" /F).
  4. Remove the script files and the installation directory.

2) Run `WindowsClearCacheInstaller.exe` as an administrator.
- The installer launches `cleanmgr.exe /sageset:1` so you can configure Disk Cleanup before the first run.
- You can choose to create a weekly scheduled task that runs the cleanup with highest privileges.
- The cleaner script is copied to `c:\Program Files\WindowsClearCache`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The path c:\Program Files is hardcoded. This path can be different on non-English versions of Windows or on systems where it has been moved. It's better to use the environment variable %ProgramFiles% to be more accurate, especially since the NSIS script correctly uses the $PROGRAMFILES variable.

Suggested change
- The cleaner script is copied to `c:\Program Files\WindowsClearCache`.
- The cleaner script is copied to `%ProgramFiles%\WindowsClearCache`.

inode64 and others added 2 commits September 8, 2025 20:12
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@inode64 inode64 merged commit c4745fd into main Sep 8, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants