bat 脚本处理windows 文件
背景:以下脚本使用了导出文件列表、移动文件、复制文件、report 系统信息、分段执行的功能
主要针对在从事于Easeware公司中,对软件Bug中,所需文件的提取。
代码片段说明:
cls
ver | find "5.1." > NUL && goto win_xp
:win_xp
## 判断出用户操作系统为windows xp 将执行:win_xp下面的代码块,其他代码不执行。
dir /B /S > fileList.txt
## 获取当前目录下所有的文件夹名、文件名列表,并导出到fileList.txt文件中
rd /s /q DriverEasy
## 删除当前目录下的DriverEasy文件夹
msinfo32 /report %userprofile%\Desktop\info.txt
## 导出用户电脑设备信息,并将文件保存到桌面
完整代码:
@echo off cls ver | find "5.1." > NUL && goto win_xp
ver | find "5.1." > NUL && goto winvista
ver | find "6.1." > NUL && goto win7
ver | find "6.2." > NUL && goto win8
ver | find "6.3." > NUL && goto win8.1 :win_xp
@echo The current system is:WinXP
cd "%AppData%\Easeware\DriverEasy"
dir /B /S > fileList.txt
move fileList.txt "%userprofile%\Desktop"
cd "%AppData%\Easeware\DriverEasy\drivers"
copy DownloadDrivers.data "%userprofile%\Desktop"
cd C:\Program Files\Common Files\Microsoft Shared\MSInfo
msinfo32.exe /report "%userprofile%\Desktop\info.txt"
@echo ----------------------------------------
goto end :winvista
@echo The current system is:winvista
cd %userprofile%\AppData\Roaming\Easeware\DriverEasy
dir /B /S > fileList.txt
move fileList.txt %userprofile%\Desktop
cd %userprofile%\AppData\Roaming\Easeware\DriverEasy\drivers
copy DownloadDrivers.data %userprofile%\Desktop
msinfo32 /report %userprofile%\Desktop\info.txt
@echo ----------------------------------------
goto end :win7
@echo The current system is:win7
cd %userprofile%\AppData\Roaming\Easeware\DriverEasy
dir /B /S > fileList.txt
move fileList.txt %userprofile%\Desktop
cd %userprofile%\AppData\Roaming\Easeware\DriverEasy\drivers
copy DownloadDrivers.data %userprofile%\Desktop
msinfo32 /report %userprofile%\Desktop\info.txt
@echo ----------------------------------------
goto end :win8
@echo The current system is:win8
cd %userprofile%\AppData\Roaming\Easeware\DriverEasy
dir /B /S > fileList.txt
move fileList.txt %userprofile%\Desktop
cd %userprofile%\AppData\Roaming\Easeware\DriverEasy\drivers
copy DownloadDrivers.data %userprofile%\Desktop
msinfo32 /report %userprofile%\Desktop\info.txt
@echo ----------------------------------------
goto end :win8.1
@echo The current system is:win8.1
cd %userprofile%\AppData\Roaming\Easeware\DriverEasy
dir /B /S > fileList.txt
move fileList.txt %userprofile%\Desktop
cd %userprofile%\AppData\Roaming\Easeware\DriverEasy\drivers
copy DownloadDrivers.data %userprofile%\Desktop
msinfo32 /report %userprofile%\Desktop\info.txt
@echo ----------------------------------------
goto end @echo Can not get the current operating system version
@echo ---------------------------------------- :end
pause
Code
bat 脚本处理windows 文件的更多相关文章
- [ Windows BAT Script ] BAT 脚本获取windows权限
BAT 脚本获取windows权限 @echo off echo I am trying to run as Administrator %1 %2 ver|find "5."&g ...
- bat脚本运行py文件失败(一闪而过)
简单记录下问题及原因,方便回顾. 问题 通过 bat 脚本运行 py 文件时,终端一闪而过,没能成功运行. 查证后发现问题出在编码上: 首先检查下bat文件编码格式(推荐 notepad++ ) 打开 ...
- [BAT脚本] 1、BAT脚本FOR循环操作文件和命令返回实例
Wednesday, 31. October 2018 08:18PM - beautifulzzzz 一.需求 需要在windows上实现一个bat脚本解析json,将json转换为自己想要的key ...
- 使用bat脚本调用py文件直接获取应用的包名和targetversion
背景: 在上一篇已经介绍过如何利用python调用aapt获取包名 https://www.cnblogs.com/reseelei-despair/p/11078750.html 但是因为每次都要修 ...
- Windows下通过bat脚本实现自动上传文件到ftp服务器
@Echo Off Echo open ip_address [port] >ftp.up Echo [username]>>ftp.up Echo [password]>&g ...
- bat脚本——删除当前文件夹的所有指定文件类型
学了这个,就不用手动删除大量的指定的文件类型,可以做到双击bat处理文件就可以删除了 比如说,我要删除当前文件夹下的txt文件和doc文件,代码如下 del *.txt* del *.doc* 其原理 ...
- .bat脚本将windows server 2008设置成ntp时间同步服务器
@echo off echo autor OAK @echo off echo -------------------------------- @echo off REG ADD HKEY_LOCA ...
- Java执行cmd命令、bat脚本、linux命令,shell脚本等
1.Windows下执行cmd命令 如复制 D:\tmp\my.txt 到D:\tmp\my_by_only_cmd.txt 现文件如图示: 执行代码: private static void run ...
- bat脚本相关
前期准备: 将要执行的脚本名字生成到一个txt文件 首先进入dos运行程序的目录下:输入dir *.jmx /B>FileScript.txt 采用dir *.jmx>list.txt 如 ...
随机推荐
- python常用工具组件
1.JS 正则 test - 判断字符串是否符合规定的正则 rep = /\d+/; rep.test("asdfoiklfasdf89asdfasdf ...
- Flask源码解读--所有可扩展点
一.前言 flask中有很多可扩展点(笔者这样称呼),其中包含了信号和请求钩子,这些信号和钩子有什么用呢?其主要作用用于帮助我们进行程序的耦合性,当然还可以让我们自定义一些行为.话不多说,通过阅读源码 ...
- [Spark][Python]DataFrame select 操作例子II
[Spark][Python]DataFrame中取出有限个记录的 继续 In [4]: peopleDF.select("age","name") In ...
- 解密自动CPS变换
7.2 1 前言 我最一开始听到 CPS 变换这个词是在王垠的博客里 (请求不要喷我),就是那篇他第一次宣传他的40行代码的文章. 我当时什么都看不懂,所以没太注意,不过我也正在学程序语言方面的东西, ...
- Nginx+upstream针对后端服务器容错的运维笔记
熟练掌握Nginx负载均衡的使用对运维人员来说是极其重要的!下面针对Nignx负载均衡upstream容错机制的使用做一梳理性说明: 一.nginx的upstream容错 1)nginx 判断节点失效 ...
- php5.6安装Zend Opcache扩展
假设php5.6安装路径为/data2/php[root@nextcloud src]# pwd/usr/local/src[root@nextcloud src]# wget http://pecl ...
- WinForm多线程+委托防止界面假死
当有大量数据需要计算.显示在界面或者调用sleep函数时,容易导致界面卡死,可以采用多线程加委托的方法解决 using System; using System.Collections.Generic ...
- 《软件工程》小组团队项目-小学生四则运算APP(First Sprint)
<软件工程>团队项目我们小组选择了小学生四则运算APP,在上学期原有的项目基础上进行更新升级.(自我感觉我们团队上学期的小学生四则运算APP是较为成功且实用的,不过这学期学习到了新的知识, ...
- MyEclipse项目里面出现红叉的解决方案?
一般出现在从别处import的项目上,只有项目文件夹上有红叉,其他地方都正常,现总结个人的几个解决方案: 有几种可能: 1,编码设置是否一致,也即是你项目原来的编码和现在eclipse用的默认编码 ...
- Hibernate_core_method
/** * Created by Administrator on 2015/11/30. *HibernateUtil */public class HibernateUtil { private ...