背景:以下脚本使用了导出文件列表、移动文件、复制文件、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 文件的更多相关文章

  1. [ Windows BAT Script ] BAT 脚本获取windows权限

    BAT 脚本获取windows权限 @echo off echo I am trying to run as Administrator %1 %2 ver|find "5."&g ...

  2. bat脚本运行py文件失败(一闪而过)

    简单记录下问题及原因,方便回顾. 问题 通过 bat 脚本运行 py 文件时,终端一闪而过,没能成功运行. 查证后发现问题出在编码上: 首先检查下bat文件编码格式(推荐 notepad++ ) 打开 ...

  3. [BAT脚本] 1、BAT脚本FOR循环操作文件和命令返回实例

    Wednesday, 31. October 2018 08:18PM - beautifulzzzz 一.需求 需要在windows上实现一个bat脚本解析json,将json转换为自己想要的key ...

  4. 使用bat脚本调用py文件直接获取应用的包名和targetversion

    背景: 在上一篇已经介绍过如何利用python调用aapt获取包名 https://www.cnblogs.com/reseelei-despair/p/11078750.html 但是因为每次都要修 ...

  5. Windows下通过bat脚本实现自动上传文件到ftp服务器

    @Echo Off Echo open ip_address [port] >ftp.up Echo [username]>>ftp.up Echo [password]>&g ...

  6. bat脚本——删除当前文件夹的所有指定文件类型

    学了这个,就不用手动删除大量的指定的文件类型,可以做到双击bat处理文件就可以删除了 比如说,我要删除当前文件夹下的txt文件和doc文件,代码如下 del *.txt* del *.doc* 其原理 ...

  7. .bat脚本将windows server 2008设置成ntp时间同步服务器

    @echo off echo autor OAK @echo off echo -------------------------------- @echo off REG ADD HKEY_LOCA ...

  8. Java执行cmd命令、bat脚本、linux命令,shell脚本等

    1.Windows下执行cmd命令 如复制 D:\tmp\my.txt 到D:\tmp\my_by_only_cmd.txt 现文件如图示: 执行代码: private static void run ...

  9. bat脚本相关

    前期准备: 将要执行的脚本名字生成到一个txt文件 首先进入dos运行程序的目录下:输入dir *.jmx /B>FileScript.txt 采用dir *.jmx>list.txt 如 ...

随机推荐

  1. ASP.NET MVC和ASP.NET Core MVC中获取当前URL/Controller/Action (转载)

    ASP.NET MVC 一.获取URL(ASP.NET通用): [1]获取完整url(协议名+域名+虚拟目录名+文件名+参数) string url=Request.Url.ToString(); [ ...

  2. Intellij实用技巧

    快捷键 Tradition 快捷键 介绍 Ctrl + Z 撤销 Ctrl + Shift + Z 取消撤销 Ctrl + X 剪切 Ctrl + C 复制 Ctrl + S 保存 Tab 缩进 Sh ...

  3. 生成、查看文件的MD5、SHA、SHA256值

    生成文件的MD5.SHA.SHA256 Linux系统生成MD5.SHA.SHA256 md5sum file1.zip  >> MD5.txt sha1sum file1.zip > ...

  4. odoo订餐系统之订单设计

    订餐系统的主要功能便是用户下单部分,这里我们分为表头mylunch_order和表体mylunch_order_line两张主要的数据表,表头主要记录订单的一些通用信息,比如下单的操作人员 下单日期 ...

  5. Ionic app 上传图片之webApi接口

    App上传图片对应的webApi服务端是怎么处理的呢? using System; using System.Collections.Generic; using System.Diagnostics ...

  6. npm install xxx --save-dev 与npm install xxx --save 的区别

    正常情况下: 当你为你的模块安装一个依赖模块时 1.你得先安装他们(在模块根目录下npm install module-name) 2.连同版本号手动将他们添加到模块配置文件package.json中 ...

  7. HDU3062&&HDU1814

    Preface 两道2-SAT模板题. HDU3062 看题目就一眼2-SAT.一对夫妻看成一个变量,之间的矛盾可以看成限制. 考虑不同席的限制,相当于选了\(i\)就不选\(j\),即必选\(j'\ ...

  8. HTTP Error 500.22 - Internal Server Error 错误解决方案

    1. 首先进入IIS ,配置IIS 应用程序池的.Net Framework版本 2. 点击左侧应用程序池,再单机右侧设置,选择版本 3. 设置为经典模式 如若遇到以下错误: 解决方案:删除confi ...

  9. IIS_部署出错

    在本地开发环境没问题,但是发布到服务器出现:未能写入输出文件“c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Fil ...

  10. 从Stampery到Chronicled,区块链公证业务的实践

    Stampery就是这样一家利用比特币区块链技术代替公证人的创业公司,能为所有的敏感文件提供具有法律约束力的证明.可以用Stampery证明任何文件,它能很好地保护知识产权,证明遗嘱.宣誓.合同.家庭 ...