In cmd, you can use the "rd/s/q drive letter:\some folder" command to forcefully delete the folder. You only need to open cmd and enter "rd/s/q drive letter:\somewhere folder". Folder" command, press the "Enter key" on the keyboard to forcefully delete the specified folder.
The operating environment of this tutorial: Windows 7 system, Dell G3 computer.
1. Delete files or directories CMD command:
rd/s/q drive letter:\a certain folder (forcefully delete the file folder and all files in the folder)
del/f/s/q Drive letter:\File name (Forcibly delete files, the file name must be added with the file suffix)
2. Delete files or directories BAT command:
1. Create a new .BAT batch file and enter the following command, then drag and drop the file to be deleted onto the batch file icon to delete it.
DEL /F /A /Q
RD /S /Q
3. Recommended forced deletion tool software:
1. Green Eagle file unlocking Deleteer FileSuperDelete
2, PowerTool.exe
3, Unlocker 1.8.7
In Windows systems, we will inevitably encounter situations where files cannot be deleted using conventional methods. . Especially users using Windows XP systems encounter such problems more frequently. In order to relieve users' confusion, we will try to effectively delete those stubborn files through various unconventional means.
1. Conventional methods for deleting stubborn files
1. After restarting the Windows operating system, delete files in the conventional way.
2. Use Del, Deltree and other commands to delete in the DOS (or command prompt) interface.
3. Use third-party tools other than Windows Explorer to delete, such as Total Commander, ACDSee, FlashFXP, Nero and other software with the function of browsing folders.
4. If you have installed more than two operating systems, you can delete the files of other operating systems in the current system.
5. Press the F8 key during startup to select safe mode to perform the deletion operation.
Below, we will make a detailed analysis of specific problems and introduce the unconventional methods that should be adopted when files cannot be deleted due to various reasons.
2. Delete files "in use by other programs"
Problem manifestation:
In Windows XP system, I am trying to delete a large-capacity AVI format file, but the system fails. It always prompts that the deletion operation cannot be performed because other programs are in use, even when the computer is first booted into the Windows system.
Problem Solution:
Method 1: Open Notepad, click "File" → "Save As" in the menu bar, and name the file consistent with the name of the file you want to delete (including the extension) , and then replace it, you will find that the capacity becomes 0 KB. At this point, just execute the delete command.
Method 2: Create a new folder in the same directory as the AVI file, and then restart. Now, do not select the AVI file, first select the newly created folder, and then press the Ctrl key at the same time to delete the AVI file.
Method 3: Change the extension of the AVI file to any other invalid file type, and then perform the delete operation.
Method 4: A once and for all method is to disable the media preview function of Windows XP, click "Start" → "Run", enter: "CMD" and press Enter. Then enter in the "Command Prompt" window: regsvr32 /u shmedia.dll
After pressing Enter to confirm the operation, the preview function of the video file will be uninstalled. In the future, when you need to restore the video file preview function, enter the regsvr32 shmedia.dll command in the "Command Prompt".
Method 5: Start the media player that played the AVI file and open another file. After that, just try deleting it again.
Method 6: You can delete it with the WinRAR program. Right-click the AVI file, select "Add to compressed file" in the pop-up menu, and then select "After Compression" in the "General" tab of the pop-up window. Delete source files" checkbox. After confirming the operation, perform the compression operation. Finally delete the compressed file.
Method 7: Call up the "Windows Task Manager" and choose to end the Explorer process, but do not close the window at this time. At this time, a crash-like situation will occur. We switch to the "Applications" tab, click the "New Task" button, enter Explorer.exe and confirm the operation. After that, the desktop returns to normal, and you can perform the deletion operation again.
3. Cleverly delete “non-empty folders” or “bad files”
Problem manifestation:
Under Windows XP system (NTFS partition format), whether in Neither the resource manager nor third-party tools can delete the specified file. For example, if I use Total Commander to delete it, it will first prompt that the folder is not empty, but nothing will happen after confirmation. Even if I boot from a DOS disk and load the read-write version of ntfs for dos pro, I can't delete it. The prompt says "bad file name", but I can see the folder.
problem solved:
The inability to delete the file in this case is most likely caused by the long file name in the NTFS format. We can use the 8.3 format to reduce the length or change part of the directory name in the path to reduce the length of the path. For example, you can temporarily rename some directories in the path, or use the 8.3 format in command line mode. For example, the directory of "Linux Faq" becomes "LINUXF~1" in 8.3. You can enter the directory through "Linuxf~1", and then you can use the Del command to delete the specified file. If you need to delete a directory, use the Rd command.
4. Cleverly delete files that are "in use by the specified program or file"
Problem manifestation:
When performing a file deletion operation, the system prompts you to specify in a pop-up dialog box A warning message such as the program or file is in use and cannot be deleted.
Problem Solution:
Method 1: For this kind of situation, we can solve the problem by ending the related process of pre-deleted files. So, how can we know which processes a specified file is associated with? You can use the WhoLockMe gadget to find out. We run "Install.exe" to install the program first.
Next, enter the directory where the pre-deleted file is located, right-click the file and select "Who Lock Me?" in the pop-up menu.
The "Lockers" window will pop up, in which we can learn all the processes currently calling the file.
After selecting the process name, click the "Kill Process" button to pop up the "Kill-Confirmation" dialog box. Click the "Yes" button here to confirm the end of the process operation. After ending all corresponding processes, you can delete the specified file through normal channels.
Tips: In fact, this method is especially suitable for deleting Trojan servers. This extremely threatening little thing can only be deleted after blocking all processes related to it.
Method 2: If the DLL dynamic link library file called by the specified program or file is still in the memory and has not been released, it will also prompt that the file is in use when deleting it. In this case, we can delete the system's page file in the DOS environment. In the Windows 9X system, it is the "WIN386.SWP" file (located in the Windows directory of the system disk). In the Windows 2000/XP system, it is "pagefile.sys" ” file (located in the root directory of the system disk).
Method 3: If a virus firewall is resident in the system and it is checking the file you intend to delete when scanning for viruses, the system will also prompt that the file is in use. At this point, we only need to pause the real-time monitoring operation.
5. Cleverly delete other types of strange files
1. User permission issues lead to the inability to delete files
If the current Windows user login identity does not have the ability to delete the specified file/file folder permissions (for Windows NT/2000/XP/2003 operating systems), just log in as an administrator again.
2. Illegal characters prevent the file or folder from being deleted
If the file or folder cannot be deleted due to illegal characters, you can enter the file you want to delete in the "Command Prompt" interface. Directory, enter "dir>del.bat", use the DOS pipe command to automatically input the file list of the current directory into the batch command file "del.bat", and then modify the batch command file to retain only the file or directory name. And add "del" or "rd" before the file or directory name, and then run the batch command to delete it.
3. Unable to delete any files in the system
Check whether the system has anti-deletion protection software installed, if so, just delete it.
For more computer-related knowledge, please visit the FAQ column!
The above is the detailed content of What is the cmd command to force delete a folder?. For more information, please follow other related articles on the PHP Chinese website!