使bat文件删除具有未知名称的子文件夹 [英] Make a bat file delete sub folders with an unknown name

查看:170
本文介绍了使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[^]


这篇关于使bat文件删除具有未知名称的子文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆