Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

del's bug


May 22, 2021 DOS Command learning manual



When deleting files with del, you cannot use del /a /f/gt;nul 2?gt;nul?amp;echo yes|| E cho no to determine if it has been deleted, because yes is always displayed in any case. r d does not exist. So, when you don't know if you want to delete a file or a folder, you should use the following code:

@echo off

:: The order of rd and del cannot be reversed

rd /q /s "target" sgt; nul 2 sgt; nul || del /a /f "Target" sgt;nul 2 sgt;nul

pause


—— namejm