How to solve “The directory is not empty” error when running rmdir command in a batch script?

前端 未结 13 2288
悲&欢浪女
悲&欢浪女 2021-01-30 02:16

I am making a batch script and part of the script is trying to remove a directory and all of its sub-directories. I am getting an intermittent error about a sub-directory not be

13条回答
  •  旧时难觅i
    2021-01-30 02:50

    I can think of the following possible causes:

    1. there are files or subdirectories which need higher permissions
    2. there are files in use, not only by WSearch, but maybe by your virus scanner or anything else

    For 1.) you can try runas /user:Administrator in order to get higher privileges or start the batch file as administrator via context menu. If that doesn't help, maybe even the administrator doesn't have the rights. Then you need to take over the ownership of the directory.

    For 2.) download Process Explorer, click Find/Find handle or DLL... or press Ctrl+F, type the name of the directory and find out who uses it. Close the application which uses the directory, if possible.

提交回复
热议问题