I therefore thought I'd throw in a simple choice menu, just to make it clear what the batch was doing to do, and also to give the opportunity to back out if the batch was launched by accident.
I have no DOS batch skills, so I basically copied bits of other coder which I added prior to the long list of instructions that clears the logs. However, as soon as I added this menu choice, it causes the list of command to fail with a 'too many arguments error'.
I'd appreciate it if someone could help and advise me what I've done wrong when I pieced together commands to make this choice menu.
Here is the code that I am using. I've truncated the long list of 'wevtutil.exe' commands, but as I said above, there are nearly 500 of them and they work fine when they are the only commands in the batch file.
Thanks!
Code: Select all
@ECHO OFF
title Clear All Windows Event Log Files
:choice
cls
echo.
echo.
echo DELETE ALL WINDOWS EVENT LOG FILES
echo ------------------------------------
echo.
echo.
echo 1. Proceed with Deletion (all event logs will be wiped)
echo 2. Cancel and Exit (no changes wil be made)
echo.
echo.
echo.
set /P c=Type the number for option you want, then press Enter:
if /I "%c%" EQU "1" goto :clearlogs
if /I "%c%" EQU "2" goto :exit
goto :choice
:exit
exit
:clearlogs
echo.
echo.
timeout /t -1
wevtutil.exe cl Analytic
wevtutil.exe cl Application
wevtutil.exe cl DirectShowFilterGraph
wevtutil.exe cl DirectShowPluginControl
wevtutil.exe cl Els_Hyphenation/Analytic
wevtutil.exe cl EndpointMapper