提取win10 锁屏壁纸
自制提取工具:
链接:https://pan.baidu.com/s/1NPyecFctyxSbc1lxxXh0SQ
提取码:5pr4
Win10锁屏壁纸提取1.0:原始版本;
Win10锁屏壁纸提取2.0:改进版本,默认你的win10壁纸也是1920*1080;
Win10锁屏壁纸提取3.0:改进版本,通过注册表配置直接获取壁纸图片;
(有一点注意:必须放在桌面使用,否则用户的机器需要额外配置环境变量:键:EXE4J_JAVA_HOME 值:C:\anbuzhuang\Java1.7\jre<这里是打比方,如果你安装了jdk,此值也可写成%JAVA_HOME%> )
最近电脑开机,发现Windows默认的锁屏壁纸特别之绚丽,欲图之,或设之为桌面壁纸;
从网上得之保存路径:
C:\Users\asus\AppData\Local\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets
(win+R-->%LocalAppData%\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets可进入)
可是此文件夹下的文件较多,且无后缀名,导致系统不认识它们是图片,遂无缩略图,网络上的方法是将其一个个添加后缀.jpg,然后提取。
感觉不靠谱,所以我尝试用程序来提取。
代码如下:
package test;import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.text.DecimalFormat; import java.util.Properties;public class Tset1 {public static void main(String args[]) { // System.out.println(11/2); // Scanner sc = new Scanner(System.in); // System.out.println("请输入要复制去的目录:"); // String path = sc.nextLine(); // //获取windows用户信息 // Properties prop = System.getProperties();/*** win10获取美丽壁纸图片 getWallpaper*/Properties prop = System.getProperties();String username= prop.getProperty("user.name");//复制文件夹和文件 String sourcePath = "C:\\Users\\"+username+"\\AppData\\Local\\Packages\\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\\LocalState\\Assets";String path = "C:\\Users\\"+username+"\\Desktop\\win10锁屏壁纸";if ((new File(path)).exists()) {System.out.println("请先删除桌面上的-->win10锁屏壁纸<--文件夹");return;}try {long startTime = System.currentTimeMillis();//记录当前时间 copyDir(sourcePath, path);long spendTime = System.currentTimeMillis()-startTime;String time = formatDecimal(spendTime);System.out.println("批量复制的时间为:"+spendTime+"毫秒,也就是"+time+"秒");} catch (IOException e) {// TODO Auto-generated catch block e.printStackTrace();}reNameFiles(path);}//小数格式处理 毫秒转秒 小数点后一位public static String formatDecimal(long spendTime) {DecimalFormat decimalFormat=new DecimalFormat(".0");double temp = (double)spendTime/1000;if(temp>=1)return decimalFormat.format(temp);elsereturn "0"+decimalFormat.format(temp);}//批量重命名文件public static void reNameFiles(String path) {long startTime = System.currentTimeMillis();//记录当前时间String dir = path;File[] files = new File(dir).listFiles();int i = 0;for (File file : files){//循环文件夹中的文件if (file.isFile() && file.exists()) { //判断文件是否存在if(file.getName().indexOf(".")==-1) {i++;//renameTo方法的左右 路径的目录结构部分必须是一样的 否则返回falseif(file.renameTo(new File(path+"\\"+file.getName()+".jpg"))) {//这里一定要加\\不然全部文件会跑到上一级目录去。。System.out.println(i+"success");}else {System.out.println(i+"failed");}}} else {System.out.println("第"+i+"个文件不存在,请检查文件位置!");}}System.out.println("一共修改了"+i+"个文件名称");long spendTime = System.currentTimeMillis()-startTime;String time = formatDecimal(spendTime);System.out.println("批量重命名文件的时间为:"+spendTime+"毫秒,也就是"+time+"秒");}//从某位置复制文件或文件夹(包括此文件夹内的文件一起)到新文件夹public static void copyDir(String sourcePath, String newPath) throws IOException {File file = new File(sourcePath);String[] filePath = file.list();if (!(new File(newPath)).exists()) {(new File(newPath)).mkdir();}for (int i = 0; i < filePath.length; i++) {if ((new File(sourcePath + file.separator + filePath[i])).isDirectory()) {//目錄long startTime = System.currentTimeMillis();//记录当前时间copyDir(sourcePath + file.separator + filePath[i], newPath + file.separator + filePath[i]);long spendTime = System.currentTimeMillis()-startTime;String time = formatDecimal(spendTime);System.out.println("复制文件夹"+i+"的时间为:"+spendTime+"毫秒,也就是"+time+"秒");}if (new File(sourcePath + file.separator + filePath[i]).isFile()) {//文件long startTime = System.currentTimeMillis();//记录当前时间copyFile(sourcePath + file.separator + filePath[i], newPath + file.separator + filePath[i]);long spendTime = System.currentTimeMillis()-startTime;String time = formatDecimal(spendTime);System.out.println("复制文件"+i+"的时间为:"+spendTime+"毫秒,也就是"+time+"秒");}}}//从某位置复制文件到新文件夹public static void copyFile(String oldPath, String newPath) throws IOException {File oldFile = new File(oldPath);File file = new File(newPath);FileInputStream in = new FileInputStream(oldFile);FileOutputStream out = new FileOutputStream(file);;byte[] buffer=new byte[1024*1024*1024];//2097152 设1个G的容量int readByte = 0;while((readByte = in.read(buffer)) != -1){out.write(buffer, 0, readByte);}in.close();out.close();} }
在eclipse中运行以上代码便可实现提取了,以下部分是打包为Windows平台可执行的exe文件的过程:
- 将此项目从eclipse打jar包到:C:\Users\asus\Desktop\getWallpaper.jar
- 下载exe4j工具并安装(下载地址:
链接:https://pan.baidu.com/s/132hbOSHFP5Y7mkz4Pk2gdg
提取码:lx0w)此工具仅支持jdk1.7和1.8打的jar包!!
- 用exe4j工具打包jar为exe(图示为需要手动操作的地方,其余页默认next):
- 上图是后来才发现的比较重要的一步,需要注册,不然exe每次打开会出现弹框如下图,注册码是:
A-XVK258563F-1p4lv7mg7savA-XVK209982F-1y0i3h4ywx2h1A-XVK267351F-dpurrhnyarvaA-XVK204432F-1kkoilo1jy2h3rA-XVK246130F-1l7msieqiwqnqA-XVK249554F-pllh351kcke50A-XVK238729F-25yn13iea25iA-XVK222711F-134h5ta8yxbm0A-XVK275016F-15wjjcbn4tpjA-XVK275016F-15wjjcbn4tpj
View Code
- Search sequence这一步删掉默认的三项,添加自己的jre(事实上如果你是开发人员并且软件是在自己机器上用的话可以直接默认,最好删掉,选择jre时跟eclipse打包的jre最好一致)
- 运行生成的Win10锁屏壁纸提取工具.exe文件便可将壁纸提取到桌面了
- 遂取之<东瀛美色,心向往之!>============================================
- 改进代码:
//将符合尺寸的图片复制到新文件夹public static void copyDir(String sourcePath, String newPath) throws IOException {File file = new File(sourcePath);String[] filePath = file.list();if (!(new File(newPath)).exists()) {(new File(newPath)).mkdir();}BufferedImage sourceImg = null;for (int i = 0; i < filePath.length; i++) {//根据图片的尺寸来找壁纸System.out.println("============="+sourcePath+"\\"+filePath[i]);sourceImg =ImageIO.read(new FileInputStream(sourcePath+"\\"+filePath[i]));if(sourceImg.getWidth()==1920&&sourceImg.getHeight()==1080) {long startTime = System.currentTimeMillis();//记录当前时间copyFile(sourcePath + file.separator + filePath[i], newPath + file.separator + filePath[i]);long spendTime = System.currentTimeMillis()-startTime;String time = formatDecimal(spendTime);System.out.println("复制文件"+i+"的时间为:"+spendTime+"毫秒,也就是"+time+"秒");}}}
- 再次改进:壁纸是由注册表配置而控制的(找到注册表,就可以找到图片的路径,就不需要写死了),在注册表中直接搜索壁纸得到其配置路径
- 再次改进代码如下:
package test;import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.Properties;public class Tset1 {public static void main(String args[]) {try {/*** 通过win10注册表里边配置的landscapeImage项,得到锁屏壁纸的存储位置*/Process ps = null;//当路径中有空格时,要把路径打上引号。ps = Runtime.getRuntime().exec("reg query \"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\Current"+ "Version\\Authentication\\LogonUI\\Creative\\S-1-5-21-249709250-2082970024-2567614095-1001\\131857916557146304\"");ps.getOutputStream().close();InputStreamReader i = new InputStreamReader(ps.getInputStream());String line;BufferedReader ir = new BufferedReader(i);while ((line = ir.readLine()) != null) {if(line.contains("landscapeImage")) {line = line.substring(line.indexOf(":")-1,line.length());break;}}/*** 通过拷贝和重命名提取壁纸 getWallpaper*/Properties prop = System.getProperties();String username= prop.getProperty("user.name");//复制文件夹和文件 String path = "C:\\Users\\"+username+"\\Desktop\\chenyuuurefrain@gmail.jpg";File oldFile = new File(line);File file = new File(path);FileInputStream in = new FileInputStream(oldFile);FileOutputStream out = new FileOutputStream(file);;byte[] buffer=new byte[1024*1024*1024];//2097152 设1个G的容量int readByte = 0;while((readByte = in.read(buffer)) != -1){out.write(buffer, 0, readByte);}in.close();out.close();} catch (IOException e) {e.printStackTrace();}} }
- 卧槽,隔两天再运行,bug…原来注册表S-1-5-21-249709250-2082970024-2567614095-1001目录后的结构是会变的,再改:
package test;import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import java.util.Properties;public class Tset1 {public static void main(String args[]) {try {/*** 通过win10注册表里边配置的landscapeImage项,得到锁屏壁纸的存储位置*/Process ps = null;String chu = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Authentication\\LogonUI\\Creative\\S-1-5-21-249709250-2082970024-2567614095-1001";ps = Runtime.getRuntime().exec("reg query \""+chu+"\""); //\131857916557146304\ <----不能写到这一级 ps.getOutputStream().close();InputStreamReader i = new InputStreamReader(ps.getInputStream());System.out.println(i);String line;BufferedReader ir = new BufferedReader(i);List<String> list = new ArrayList<String>();while ((line = ir.readLine()) != null) {if(line.contains("S-1-5-21-249709250-2082970024-2567614095-1001\\")) {line = line.substring(line.indexOf("S-1-5-21-249709250-2082970024-2567614095-1001\\")+46,line.length());list.add(line);}}List<String> fileList = new ArrayList<String>();for(int j=0;j<list.size();j++) {ps = null;ps = Runtime.getRuntime().exec("reg query \""+chu+"\\"+list.get(j)+"\"");ps.getOutputStream().close();i = null;i = new InputStreamReader(ps.getInputStream());ir = null;ir = new BufferedReader(i);line = null;while ((line = ir.readLine()) != null) {if(line.contains("landscapeImage")) {line = line.substring(line.indexOf(":")-1,line.length());fileList.add(line);}}}/*** 通过拷贝和重命名提取壁纸 getWallpaper*/Properties prop = System.getProperties();String username= prop.getProperty("user.name");for(int k=0;k<fileList.size();k++) {copyF(username, k, fileList.get(k));}} catch (IOException e) {e.printStackTrace();}}public static void copyF(String username,int xxx,String fileP) throws IOException {String path = "C:\\Users\\"+username+"\\Desktop\\chennyuuu@gmail.com."+xxx+".jpg";File oldFile = new File(fileP);File file = new File(path);FileInputStream in = new FileInputStream(oldFile);FileOutputStream out = new FileOutputStream(file);;byte[] buffer=new byte[1024*1024*1024];//2097152 设1个G的容量int readByte = 0;while((readByte = in.read(buffer)) != -1){out.write(buffer, 0, readByte);}in.close();out.close();} }
View Code
转载于:https://www.cnblogs.com/lovesufang/p/9844529.html
提取win10 锁屏壁纸相关推荐
- python实现动态壁纸_利用Python批量提取Win10锁屏壁纸实战教程
前言 相信使用Win10的朋友会发现,每次开机锁屏界面都会有不一样的漂亮图片,这些图片通常选自优秀的摄影作品,十分精美. 但是由于系统会自动更换这些图片,所以就算再好看的图片,也许下次开机之后就被替换 ...
- python f.write 保存图片到路径_实战 | Python批量提取Win10锁屏壁纸
实战 | Python批量提取Win10锁屏壁纸 使用Win10的朋友会发现,每次开机锁屏界面都会有不一样的漂亮图片,这些图片通常选自优秀的摄影作品,十分精美. 但是由于系统会自动更换这些图片,所以就 ...
- python解除windows锁屏_实战 | Python批量提取Win10锁屏壁纸
使用Win10的朋友会发现,每次开机锁屏界面都会有不一样的漂亮图片,这些图片通常选自优秀的摄影作品,十分精美. 但是由于系统会自动更换这些图片,所以就算再好看的图片,也许下次开机之后就被替换掉了. 借 ...
- 实战 | Python批量提取Win10锁屏壁纸
使用Win10的朋友会发现,每次开机锁屏界面都会有不一样的漂亮图片,这些图片通常选自优秀的摄影作品,十分精美. 但是由于系统会自动更换这些图片,所以就算再好看的图片,也许下次开机之后就被替换掉了. 借 ...
- python win10 桌面_实战 | Python批量提取Win10锁屏壁纸
使用Win10的朋友会发现,每次开机锁屏界面都会有不一样的漂亮图片,这些图片通常选自优秀的摄影作品,十分精美.但是由于系统会自动更换这些图片,所以就算再好看的图片,也许下次开机之后就被替换掉了. 借助 ...
- python win10 桌面_利用Python批量提取Win10锁屏壁纸实战教程
前言 相信使用Win10的朋友会发现,每次开机锁屏界面都会有不一样的漂亮图片,这些图片通常选自优秀的摄影作品,十分精美. 但是由于系统会自动更换这些图片,所以就算再好看的图片,也许下次开机之后就被替换 ...
- python爬虫win10程序_Python爬虫教程:批量提取Win10锁屏壁纸
使用Win10的朋友会发现,每次开机锁屏界面都会有不一样的漂亮图片,这些图片通常选自优秀的摄影作品,十分精美.但是由于系统会自动更换这些图片,所以就算再好看的图片,也许下次开机之后就被替换掉了. 借助 ...
- python实现动态壁纸_实战 | Python批量提取Win10锁屏壁纸
使用Win10的朋友会发现,每次开机锁屏界面都会有不一样的漂亮图片,这些图片通常选自优秀的摄影作品,十分精美.但是由于系统会自动更换这些图片,所以就算再好看的图片,也许下次开机之后就被替换掉了. 借助 ...
- win10锁屏壁纸保存方法
第一步:Windows 10锁屏壁纸的根目录路径如下: C:\Users\用户名\AppData\Local\Packages\Microsoft.Windows.ContentDeliveryMan ...
- Win系统 - 喜欢的WIN10锁屏壁纸,怎么下载?
Win10的锁屏界面有时候挺好看的,要是能拿来当壁纸就好了........ 锁屏壁纸?拿来当桌面?放着我来!! 先看一下Windows锁屏壁纸应该在哪里设置: 桌面空白处右击,选择个性化,在锁屏界面即 ...
最新文章
- MVC模式和文档/视图结构
- tensorflow随笔-acosh,acos
- Qt treeWidget 查找指定字段内容的条目并跳转到该条目
- git 命令commit_Git Commit命令解释
- mysql html 转义_HTML/Mysql/XML 转义字符,备查
- Bootstrap学习(一)
- 【转载】MongoDB集群和实战详解
- 小D课堂 - 新版本微服务springcloud+Docker教程_4-02 微服务调用方式之ribbon实战 订单调用商品服务...
- 支持HTTP2的cURL——基于Alpine的最小化Docker镜像
- How can I add a site title refiner
- VS2019 OpenCV安装与配置教程
- 如何听节拍器_学琴必备的节拍器,你用对了么?
- You must address the points described in the following [1] lines before starting Elasticsearch.
- lol英雄皮肤图片爬取
- wifi的html页面,笔记本怎么设置wifi
- c语言小蜜蜂编程题,小蜜蜂 pascal程序
- 第四天(打造离线下载服务器)
- 转行学Java怎么样?Java培训机构有什么避雷的要点?
- 群晖NAS DSM7.0系统安装qBittorrent和transmission套件教程
- lincx Shell脚本编程之字符串的截取,替换,按条件掐头去尾