In win7, the automatic wallpaper replacement function is integrated. In other words, one day I downloaded a wallpaper package from verycd, and more than 1000 of them were game wallpapers, which were directly set to automatic replacement. Many beautiful wallpapers, but some do not like them. Are they deleted one by one, OMG. Or delete it when win7 switches to a wallpaper that you don't like. There are more than 1000 million users and they are looking for dead ones. Start the thief and write a script to directly Delete the currently used wallpaper.
Script File (deletewallpaper. JS)
// Settings
// User name, user name for logon to the current system
VaR
Username
=
"Wilford"
;
// Folder containing Wallpaper
VaR
Folders
=
New
Array
();
Folders
.
Push
("F: // wide screen Wallpaper"
);
VaR
FSO
=
New
Activexobject
("Scripting. FileSystemObject"
);
VaR
F1
=
FSO
.
GetFile
("D: // users //"
+
Username
+
"// Appdata // roaming // Microsoft // windows // themes // transcodedwallpaper.jpg"
);
VaR
Filedelnum
=
0
;
VaR
Filedel
=
""
;
For
(I
=
0
; I
<
Folders
.
Length
; I
++
)
{
VaR
Folder
=
FSO
.
Getfolder
(Folders
[
I
]);
VaR
ITER
=
New
Enumerator
(Folder
.
Files
);
For
(;!
ITER
.
Atend
(); ITER
.
Movenext
())
{
VaR
File
=
ITER
.
Item
();
If
(F1
.
Size
=
File
.
Size
)
{
Filedelnum
++;
Filedel
+ =
File
.
Path
+
"/R/N"
;
File
.
Delete
();
}
}
}
VaR
DT
=
New
Date
();
VaR
Log
=
"-----"
+
DT
.
Tolocalestring
() +
"Deleting files"
+
Filedelnum
+
"Items"
+
"-----/R/N"
;
Log
+ =
Filedel
;
Log
+ =
"/R/N"
;
// Record logs to files
Logfile
=
FSO
.
Opentextfile
("Deletewallpaper. log"
,
8
,
True
);
Logfile
.
Write
(Log
);
Logfile
.
Close
();
Wscript
.
Echo
(Log
);
You can create a shortcut, put it in the Start menu, and set the shortcut key.
There are two disadvantages:
1. This method uses the file size to determine whether it is the same file. Although the two images have the same file size, the probability is not high, but this is not a reliable method. Be cautious when considering MD5 or byte comparison.
2. This method is only valid for JPG files. other formats, such as PNG, will be converted to JPG after Windows copies, so the file size is different. To solve this problem, we can only compare it from the image level. This is a relatively advanced technology that I have not studied.