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

转载于:https://www.cnblogs.com/Mrhuangrui/p/4569322.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值