Try   HackMD

Notes:強制刪除無法移除的檔案或資料夾

〔Method 1〕在資源檢視器中將相關程序關閉後再刪除

有時候想刪掉某些檔案,系統會跳出提示說「其他應用程式已開啟此檔案」,通常解決辦法是〔打開工作管理員 > 效能 > 資源檢視器 > CPU > 關聯控制碼〕,把在背景運行的這個應用程式相關檔案關閉,就可以刪除了。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

〔Method 2〕自行建立 file_del.bat 強制刪除檔案的批次檔

但有時候會碰上找不到相關程序的問題(明明本機完全沒有找到這個程式在運行的跡象)。這時候可以利用建立 .bat 批次檔來強制刪除這些殘存的資料夾或檔案。

- Step 1:開啟一個新文字文件,複製貼上以下命令

DEL /F /A /Q \\?\%1 RD /S /Q \\?\%1

- Step 2:把這個 .txt 另存為 file_del.bat 批次檔

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

- Step 3:把想要強制刪除的檔案拖曳到 file_del.bat

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

直接把想刪除的資料夾或是檔案拖曳到 file_del.bat 檔上,沒有意外就可以順利刪除了。

如果還是無法刪除(可能是遇上惡意軟體)可以考慮打開登錄編輯程式一個個搜尋刪除相關程序的左側資料夾〔執行 > regedit > 編輯 > 尋找〕但登錄編輯程式裡面檔案攸關電腦運行基礎,如果沒有很熟悉的話建議不要亂刪。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

〔Method 3〕更改副檔名後將電腦重新啟動,再刪除

以上如果都沒有用,假設你刪除不了的殘存檔案叫做 LdBoxDrv.sys(純舉例,這是刪除某手機模擬器後會遺留的檔案),可以右鍵把副檔名更改為 .txt,再來重新啟動電腦,再試一次強制刪除。原理是 .sys 這種系統檔可能在開機的時候就自動啟動運行了,所以你才無法強制刪除。


〔Parameters〕

批次檔寫入 Windows CMD 命令提示字元的語法介紹

DEL:刪除一個或數個檔。
RD:刪除一個或數個資料夾。
DEL [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names
RD [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names

names(萬用字元):指定一個或數個檔案或資料夾清單。可被用來刪除多個檔案。如果指定了一個資料夾,資料夾中的所有檔案都將被刪除。

/P:刪除每一個檔案之前跳出提示訊息要求確認。
/F:強制刪除唯讀檔案。
/S:從所有子資料夾刪除指定檔案。
/Q:安靜模式。刪除全域萬用字元時,不會跳出提示訊息就刪除。
/A:根據屬性選擇要刪除的檔案。
批次處理每次能處理的變數從 %0-%9 共 10 個
%0:預設給批次檔名使用
%1:預設為使用此批次處理時輸入的的第一個值
%2-%9:同理,指輸入的第 2-9 個值

: : 20210420 : : 與松 YUSONG : :

tags: notes tutorials withhhsong