星期四, 8月 15, 2013

對付win7重灌之後無法刪除的檔案

重灌WIN7之後,再把原本的資料碟接上使用,發現要重新連上Google 雲端硬碟得要先把舊資料夾清空。原本簡單的動作,卻一直卡在權限的問題。可能是資料夾和檔案的權限都屬於已經消失的舊系統使用者。試了很多方法,最後找到這個才成功刪除掉檔案。

  1. Take ownership of the files. Start a Command Prompt (cmd) as an administrator, and enter:
    takeown /f file
    takeown /f directory /r
    
  2. Give yourself full rights on the file:
    cacls file /G username:F
    cacls directory /T /G username:F
    
cacls can be used with wildcards and directory traversal. See also:

沒有留言: