﻿# 如何快速刪除系統中所有 Thumbs.db 與其他系統檔案

在 Windows 作業系統裡經常有許多檔案是由系統所控管的，所以在預設的情況下你看不到，而且在 DOS 模式下按 DIR 查詢檔案列表也看不到，因為 Windows 有分兩個等級來隱藏這些特殊的檔案，分別是 **隱藏檔**(Hidden file) 與 **系統檔**(System file)，像是常見的 Thumbs.db 就是用來儲存該目錄下快取資訊，例如照片縮圖等，除此之外，病毒或木馬也經常透過這手法來達到隱匿檔案的目的。

**找出所有系統隱藏檔**

例如先進入特定目錄，例如 D:\\ 然後再執行以下指令

```
attrib /d /s * | findstr "^...SH."
```

   [![](https://stwillblogassets.blob.core.windows.net/files/images/external/stwillblogassets.blob.core.windows.net/7154c7ef7a1f2948473e-image_thumb_2.png)](https://stwillblogassets.blob.core.windows.net/files/images/external/stwillblogassets.blob.core.windows.net/1e23825f217709bc0b10-image_13.png)

**找出特定檔名的系統隱藏檔**

例如我只要找出所有系統隱藏檔檔名有 Thumbs.db 的

```
attrib /d /s * | findstr "^...SH."  | findstr "Thumbs\.db"
```

   [![](https://stwillblogassets.blob.core.windows.net/files/images/external/stwillblogassets.blob.core.windows.net/f023cc0c9f5b30e56389-image_thumb_3.png)](https://stwillblogassets.blob.core.windows.net/files/images/external/stwillblogassets.blob.core.windows.net/047dac1b8acb0ddff134-image_14.png)

**利用樣式比對找出特定檔名樣式的系統隱藏檔案**

如下範例可搜尋出所有副檔名為 db （或完整檔名以 .db 結尾）的檔案

```
attrib /d /s * | findstr "^...SH." | findstr "\.db$"
```

**刪除透過 iTune 或其他 MP3 播放器自動下載的專輯照片或專輯封面照片**

```
del /A:SH /S AlbumArt*.jpg Folder.jpg
```

**刪除所有該目錄(含子目錄)所有檔名為 Thumbs.db 且標注「系統」與「隱藏」屬性的檔案**

```
del /A:SH /S Thumbs.db
```

**刪除所有該目錄(含子目錄)所有檔名為 ehthumbs\_vista.db 且標注「系統」與「隱藏」屬性的檔案**

```
del /A:SH /S ehthumbs_vista.db
```

   *註：這檔案是 Media Center 的影片或照片的縮圖快取檔*

**刪除特定目錄下所有 desktop.ini 桌面定義檔 ( 小心不要把自己桌面的 desktop.ini 給刪除了 )**

```
del /A:SH /S desktop.ini
```

*註：此檔案可用來決定檔案總管如何顯示這個資料夾*

**刪除特定目錄下所有 autorun.ini 自動啟動檔**

一般來說 autorun.ini 都只會設定成隱藏檔而已，刪除的時候要用以下指令：

```
del /A:H autorun.ini
```

有些木馬會刻意將此檔案標注為**系統檔**，這時就會非常詭異，不過還是可以用上述指令來刪除。

**總結**

-   善用 **找出所有系統隱藏檔** 的技巧，有時甚至可以找到木馬或病毒
-   利用 DEL 命令可快速刪檔，但使用上要特別小心，刪除掉的檔案在「資源回收桶」是找不到的!

**相關連結**

-   [Using ATTRIB, CHKDSK, or DIR Command to Locate Files](https://web.archive.org/web/20130619003011/http://support.microsoft.com/kb/89727/en-us)
-   [Microsoft DOS attrib command](http://www.computerhope.com/attribhl.htm)
-   [attrib](http://technet.microsoft.com/en-us/library/cc754186.aspx)
-   [Findstr](http://technet.microsoft.com/en-us/library/cc732459.aspx)
-   [Desktop.ini 介紹](http://edisonshih.pixnet.net/blog/post/28051668)
-   [如何查出目錄中有哪些「詭異」的檔案 ( 系統、隱藏、唯讀 )](/post/2009/02/02/Using-Attrib-and-Findstr-to-find-strange-files-in-Windows.aspx)
