Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reply to/avoid asking for confirmation from rmdir?

I'm trying to make a batch file that will delete a folder in each user profile. But when I run the batch file, it'll ask "Are you sure you want to delete Y/N. I need this file to run without interaction from the user, so is there a way to get around that? i.e. to make it automatically answer Y or a way to hide the CMD window altogether?

This is what I have so far:

@echo off

REM This will hide the CMD window while the processes are running
REM Input code here to hide CMD window

REM A message to ask the user to save their Outlook emails they have open

mshta javascript:alert("Please be sure to save any emails that you need in Outlook. Click OK to continue.");close();

REM This will stop DM, Email Marker, Email Filer, Interceptor, Papihost, and Outlook.
taskkill /IM DM.exe /F
taskkill /IM DMMarkEmail.exe /F
taskkill /IM EmailAutoBulkFiling.exe /F
taskkill /IM Interceptor.exe /F
taskkill /IM OUTLOOK.EXE /F
taskkill /IM PAPIHost.exe /F

REM This will delete the DM cache in Appdata under the current user
RMDIR /s "%userprofile%\Appdata\Roaming\OpenText\DM\Cache"

REM This will start all of the programs that were closed
REM START DM.exe

REM Commenting the Marker and Filer since some users don't want it

REM START DMMarkemail.exe
REM START Email AutoBulkFiling.exe
REM START Interceptor.exe
REM START OUTLOOK.EXE
REM START PAPIHost.exe
@echo off

Thanks for the feedback in advance.

*Edit, I took the C: out, worked, thanks David Candy for that.

like image 504
user2938026 Avatar asked Oct 23 '25 17:10

user2938026


1 Answers

You can use the '/Q' option:

rmdir /S /Q "%userprofile%\Appdata\Roaming\OpenText\DM\Cache"
like image 164
kspence Avatar answered Oct 25 '25 09:10

kspence



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!