使bat文件删除具有未知名称的子文件夹
问题描述:
所以我有一个卸载bat文件,我的程序就是我的bat文件不会删除其他文件夹里面有子文件夹。另外我不知道子文件夹的名称,所以如何制作它以删除1main文件夹中的文件和子文件夹? Uninstall.bat
SO I have a uninstall bat file for my program the thing is my bat file will not delete other folders if there are sub folders inside of it. Plus I don't know the name of the sub folders so how do I make it so it will delete the files and subfolders inside of 1main folder?Uninstall.bat
@echo off
:main
echo are you shure you want to remove backup maker?
set /p yn=(Y/N)
if %yn%== Y goto yup
if %yn%== y goto yup
if %yn%== N goto nine
if %yn%== n goto nine
:undef
echo invalid choice.
goto :main
:nine
exit
:yup
echo removing
del logs\backupdata.txt
rd backups
rd logs
del Backup_maker.bat
pause
DEL "%~f0"
答
您可以使用rd或rmdir命令使用/ s开关:
rmdir / rd命令 [ ^ ]
You can use the rd or rmdir commands with the /s switch:
rmdir/rd command[^]