如何回复/避免要求rmdir确认?

时间:2013-10-30 16:20:32

标签: windows batch-file cmd

我尝试制作一个批处理文件,删除每个用户个人资料中的文件夹。但是当我运行批处理文件时,它会询问"您确定要删除Y / N.我需要这个文件在没有用户交互的情况下运行,所以有没有办法解决这个问题?即使它自动回答Y或完全隐藏CMD窗口的方式?

这是我到目前为止所做的:

@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

感谢您的反馈。

*编辑,我拿出了C:out,work,感谢David Candy。

2 个答案:

答案 0 :(得分:2)

您可以使用'/ Q'选项:

rmdir /S /Q "%userprofile%\Appdata\Roaming\OpenText\DM\Cache"

答案 1 :(得分:0)

我不记得确切,但它是这样的:

RMDIR /S /Q "%userprofile%\Appdata\Roaming\OpenText\DM\Cache"

OR

ECHO Y| RMDIR /S "%userprofile%\Appdata\Roaming\OpenText\DM\Cache"