3

我正在尝试制作一个批处理文件,该文件将删除每个用户配置文件中的一个文件夹。但是当我运行批处理文件时,它会问“你确定要删除 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: 拿出来了,工作,感谢大卫糖果。

4

2 回答 2

3

您可以使用“/Q”选项:

rmdir /S /Q "%userprofile%\Appdata\Roaming\OpenText\DM\Cache"
于 2013-10-30T17:04:18.277 回答
0

具体记不太清了,大概是这样的:

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

或者

ECHO Y| RMDIR /S "%userprofile%\Appdata\Roaming\OpenText\DM\Cache"
于 2013-10-30T17:19:05.353 回答