bat 指令碼處理windows 檔案

來源:互聯網
上載者:User

標籤:

背景:以下指令碼使用了匯出檔案清單、移動檔案、複製檔案、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 offcls    ver | find "5.1." > NUL &&  goto win_xp     ver | find "5.1." > NUL &&  goto winvistaver | 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.txtmove fileList.txt "%userprofile%\Desktop"cd "%AppData%\Easeware\DriverEasy\drivers"copy DownloadDrivers.data "%userprofile%\Desktop"cd C:\Program Files\Common Files\Microsoft Shared\MSInfomsinfo32.exe /report "%userprofile%\Desktop\info.txt"@echo ----------------------------------------  goto end  :winvista @echo           The current system is:winvista cd %userprofile%\AppData\Roaming\Easeware\DriverEasydir /B /S  > fileList.txtmove fileList.txt %userprofile%\Desktopcd %userprofile%\AppData\Roaming\Easeware\DriverEasy\driverscopy DownloadDrivers.data %userprofile%\Desktopmsinfo32 /report %userprofile%\Desktop\info.txt@echo ----------------------------------------  goto end   :win7  @echo           The current system is:win7  cd %userprofile%\AppData\Roaming\Easeware\DriverEasydir /B /S  > fileList.txtmove fileList.txt %userprofile%\Desktopcd %userprofile%\AppData\Roaming\Easeware\DriverEasy\driverscopy DownloadDrivers.data %userprofile%\Desktopmsinfo32 /report %userprofile%\Desktop\info.txt@echo ----------------------------------------  goto end    :win8  @echo           The current system is:win8  cd %userprofile%\AppData\Roaming\Easeware\DriverEasydir /B /S  > fileList.txtmove fileList.txt %userprofile%\Desktopcd %userprofile%\AppData\Roaming\Easeware\DriverEasy\driverscopy DownloadDrivers.data %userprofile%\Desktopmsinfo32 /report %userprofile%\Desktop\info.txt@echo ----------------------------------------  goto end  :win8.1  @echo           The current system is:win8.1  cd %userprofile%\AppData\Roaming\Easeware\DriverEasydir /B /S  > fileList.txtmove fileList.txt %userprofile%\Desktopcd %userprofile%\AppData\Roaming\Easeware\DriverEasy\driverscopy DownloadDrivers.data %userprofile%\Desktopmsinfo32 /report %userprofile%\Desktop\info.txt@echo ----------------------------------------  goto end    @echo           Can not get the current operating system version  @echo ----------------------------------------    :end  pause  
Code

bat 指令碼處理windows 檔案

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.