zoukankan      html  css  js  c++  java
  • 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%Desktopinfo.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%EasewareDriverEasy"
    dir /B /S > fileList.txt
    move fileList.txt "%userprofile%Desktop"
    cd "%AppData%EasewareDriverEasydrivers"
    copy DownloadDrivers.data "%userprofile%Desktop"
    cd C:Program FilesCommon FilesMicrosoft SharedMSInfo
    msinfo32.exe /report "%userprofile%Desktopinfo.txt"
    @echo ----------------------------------------  
    goto end  
    
    :winvista 
    @echo           The current system is:winvista 
    cd %userprofile%AppDataRoamingEasewareDriverEasy
    dir /B /S  > fileList.txt
    move fileList.txt %userprofile%Desktop
    cd %userprofile%AppDataRoamingEasewareDriverEasydrivers
    copy DownloadDrivers.data %userprofile%Desktop
    msinfo32 /report %userprofile%Desktopinfo.txt
    @echo ----------------------------------------  
    goto end 
      
    :win7  
    @echo           The current system is:win7  
    cd %userprofile%AppDataRoamingEasewareDriverEasy
    dir /B /S  > fileList.txt
    move fileList.txt %userprofile%Desktop
    cd %userprofile%AppDataRoamingEasewareDriverEasydrivers
    copy DownloadDrivers.data %userprofile%Desktop
    msinfo32 /report %userprofile%Desktopinfo.txt
    @echo ----------------------------------------  
    goto end  
      
    :win8  
    @echo           The current system is:win8  
    cd %userprofile%AppDataRoamingEasewareDriverEasy
    dir /B /S  > fileList.txt
    move fileList.txt %userprofile%Desktop
    cd %userprofile%AppDataRoamingEasewareDriverEasydrivers
    copy DownloadDrivers.data %userprofile%Desktop
    msinfo32 /report %userprofile%Desktopinfo.txt
    @echo ----------------------------------------  
    goto end  
    
    :win8.1  
    @echo           The current system is:win8.1  
    cd %userprofile%AppDataRoamingEasewareDriverEasy
    dir /B /S  > fileList.txt
    move fileList.txt %userprofile%Desktop
    cd %userprofile%AppDataRoamingEasewareDriverEasydrivers
    copy DownloadDrivers.data %userprofile%Desktop
    msinfo32 /report %userprofile%Desktopinfo.txt
    @echo ----------------------------------------  
    goto end  
      
    @echo           Can not get the current operating system version  
    @echo ----------------------------------------  
      
    :end  
    pause  
    Code
  • 相关阅读:
    ES6关于Promise的用法
    JS进阶篇--JS数组reduce()方法详解及高级技巧
    JavaScript常用数组操作方法,包含ES6方法
    揭密 Vue 的双向绑定
    JavaScript(E5,6) 正则学习总结学习,可看可不看!
    利用scons构建project
    cuda核函数再调用核函数,多层并行
    使用微信JSSDK实现图片上传
    android 自己定义水平和圆形progressbar 仅仅定义一些style就能够
    [LeetCode] 035. Search Insert Position (Medium) (C++)
  • 原文地址:https://www.cnblogs.com/Mrhuangrui/p/4569322.html
Copyright © 2011-2022 走看看