-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from Prajwal-Prathiksh/feat--add-reset-wallpape…
…r-option Feat add reset wallpaper option
- Loading branch information
Showing
4 changed files
with
88 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<# | ||
.SYNOPSIS | ||
Resets the desktop wallpaper by removing the current transcoded wallpaper and cached files. | ||
.DESCRIPTION | ||
This script removes the current transcoded wallpaper and all cached wallpaper files from the specified directories. | ||
It then calls another script to refresh the system parameters and reset the wallpaper. | ||
.PARAMETER rootDir | ||
The root directory where the transcoded wallpaper is stored. | ||
.PARAMETER destDir | ||
The destination directory where cached wallpaper files are stored. | ||
.PARAMETER transcodedWallpaperDir | ||
The directory of the current transcoded wallpaper. | ||
.NOTES | ||
The script uses environment variables to determine the paths for the root and destination directories. | ||
.EXAMPLE | ||
.\ResetWallpaper.ps1 | ||
This command runs the script to reset the desktop wallpaper. | ||
#> | ||
# Setup the root and destination paths for the wallpaper | ||
$rootDir = "$env:APPDATA\Microsoft\Windows\Themes" | ||
$destDir = "$env:APPDATA\Microsoft\Windows\Themes\CachedFiles" | ||
$transcodedWallpaperDir = "$rootDir\TranscodedWallpaper" | ||
|
||
# Remove the old transcoded wallpaper | ||
if (Test-Path -Path $transcodedWallpaperDir) { | ||
Remove-Item -Path $transcodedWallpaperDir -Force | ||
Write-Host "Removed $transcodedWallpaperDir" | ||
} | ||
|
||
# Remove all files in the destination path | ||
$files = Get-ChildItem -Path $destDir -File | ||
foreach ($file in $files) { | ||
Remove-Item -Path $file.FullName -Force | ||
} | ||
Write-Host "Removed all files in $destDir" | ||
|
||
# Refresh the system parameters to reset the wallpaper | ||
Start-Sleep -Seconds 2 | ||
.\UpdateSystemParameters.ps1 | ||
Write-Host "Refreshed desktop to reset wallpaper." |