Open PowerShell in the Current Directory
Hold down the Shift key and right-click on a blank area within the File Explorer window of your target folder. Then select “Open in Terminal” from the context menu. This will open a PowerShell window already pointed to the current directory.
Run the Following PowerShell Command
Press Enter to execute the command. It will search for and delete all .DS_Store files recursively.
1 | Get-ChildItem -Path . -Include .DS_Store -Recurse -Force | Remove-Item -Force |
If You’re Using Command Prompt (CMD)
If you’re using CMD instead of PowerShell, you can use the following command:
⚠️ Make sure you are already in the correct target directory before running this command.
1 | for /r . %a in (.DS_Store) do del /s /q "%a" |
本文采用 CC BY-NC-SA 4.0方式授权。
转载请注明出处和本文链接,说明是否进行修改,不得用于商业用途,使用相同方式共享。
转载请注明转自:一极乐( https://yijile.com/en/how-use-windows11-powershell-terminal-commands-delete-all-ds_store-files/ )