2013-10-30 101 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" 
相關問題