2013-10-30 72 views
2

我试图做一个批处理文件,将删除每个用户配置文件中的文件夹。但是当我运行批处理文件时,它会问“你确定要删除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 

感谢提前反馈

*编辑,我把ç :出来工作,感谢David Candy。

+0

嗯,知道了感谢。 – user2938026

+1

通过在命令提示符下键入'rmdir/?'来阅读帮助文档,答案将会凝视你:-)(你只需要一个附加选项) – dbenham

+0

明白了,谢谢! – user2938026

回答

2

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

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

工作过,谢谢! – user2938026

0

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

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

OR

ECHO Y| RMDIR /S "%userprofile%\Appdata\Roaming\OpenText\DM\Cache" 
相关问题