How to delete a folder in a batch file forcely ?
(Note- C:\Anything is a folder)
My code is:
@echo off
del C:\Anything
pause
But it's always asking-
Do you want to delete "C:\Anything" Y/N ?
I want that C:\Anything should delete with askimg for permision to do that !
Please help to optimize my problem !!!
Use “RMDIR /S /Q” command to force delete a folder in CMD: After entering Command Prompt window, you can type the rmdir /s /q folder path, for example, rmdir /s /q E:\test, and press Enter key. This deletes the folder named “test” in my USB drive.
Use Shift + Delete to Force Delete File/Folder. You can select the target file or folder and press Shift + Delete keyboard shortcut to delete the file/folder permanently. This file deletion method won't pass the Recycle Bin.
How to Force Delete a File With the Windows Command Prompt. The following steps will help you force delete a file with the del command. Step 3: In the Command Prompt, type del , right-click to the paste in the folder address, and append the filename with its extension ( . html , .
set backupDir="D:\db_backup"
rmdir /s /q %backupDir%
here /q will eliminate that confirmation question.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With