Jump to content

How can I delete all of the wallpapers in the walls dir...?


Recommended Posts


Try this VBS Script

Save As DeleteWallpapers.vbs

strComputer = "."
Dim Act, Fso, DelWallpaper
Set Act = CreateObject("Wscript.Shell")
Set Fso = CreateObject("Scripting.FileSystemObject")
DelWallpaper = Act.ExpandEnvironmentStrings("%SystemRoot%\Web\Wallpaper")
'/-> WMI QUERRY
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colFileList = objWMIService.ExecQuery _
("ASSOCIATORS OF {Win32_Directory.Name='" & DelWallpaper & "'} Where ResultClass = CIM_DataFile")
Dim colFileList, objFile
'/-> LOOP THAT USES THE WMI QUERRY FOR THE WINDOW\WALLPAPER\WEB
For Each objFile In colFileList
Fso.DeleteFile(objFile.Name)
Next

Link to comment
Share on other sites

The first script only deletes the contents of the wallpaper folder.

It can be ran from any spot on the local computer.

This script delete the folder and all it contents, this can be ran from

any spot on the local computer.

Save as RemoveWallpaperFolder.vbs

Dim Act, Fso, Wallpaper
Set Act = CreateObject("Wscript.Shell")
Set Fso = CreateObject("Scripting.FileSystemObject")
Wallpaper = Act.ExpandEnvironmentStrings("%SystemRoot%\Web\Wallpaper")
Fso.DeleteFolder(Wallpaper), True

Link to comment
Share on other sites

This version should work for any 'non fresh' install, for that folder too!

@ECHO OFF
PUSHD %SYSTEMROOT%\Web\Wallpaper &&(
FOR %%? IN (BMP DIB GIF HTM JPE JPG PNG) DO (DEL/Q "*.%%?")
POPD)
GOTO :EOF

<Edit>

I say 'that folder' because it isn't the only location used for backgrounds

</Edit>

Edited by Yzöwl
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...