gunsmokingman Posted June 13, 2006 Posted June 13, 2006 Try this VBS ScriptSave As DeleteWallpapers.vbsstrComputer = "." 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
Cobra_1_Stas Posted June 13, 2006 Author Posted June 13, 2006 where to put the file?and it deletes all the files in folder or the folder?
gunsmokingman Posted June 13, 2006 Posted June 13, 2006 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 fromany spot on the local computer.Save as RemoveWallpaperFolder.vbsDim Act, Fso, Wallpaper Set Act = CreateObject("Wscript.Shell") Set Fso = CreateObject("Scripting.FileSystemObject") Wallpaper = Act.ExpandEnvironmentStrings("%SystemRoot%\Web\Wallpaper") Fso.DeleteFolder(Wallpaper), True
Cobra_1_Stas Posted June 13, 2006 Author Posted June 13, 2006 Thanks, but I found easier way:DEL "%systemroot%\Web\Wallpaper\*.jpg"=))
Yzöwl Posted June 13, 2006 Posted June 13, 2006 (edited) This version should work for any 'non fresh' install, for that folder too!@ECHO OFFPUSHD %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 June 13, 2006 by Yzöwl
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now