Pregunta

What I would like to do in my batch file is delete ALL the contents of the containing directory AND the directory itself. Currently I am using the following command:

rmdir ..\dir /S /Q & exit

This works in that it deletes ALL of the contents in dir including the batch file but it fails to delete the directory, dir. Is there a way to do this while deleting the dir also? Essentially what I would like to do is create a batch script that would reside inside a ZIP file and deletes everything that gets created from unzipping the file. The above command still leaves behind an empty directory.

¿Fue útil?

Solución

What about the following?

cd ..
rmdir .\dir /S /Q & exit

You can't delete a directory which is occupied by a running process.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top