When you do something major on your Windows, it stores the record of the errors and other noteworthy files in a Windows directory. These log files are called Win log files. So, of course, you like to delete Win Log files in Windows 10.
However, for those who don’t know about these log files, they might start taking up space on the computer.’
How to Delete Win Log Files in Windows 10?
There is a way through which these files can be deleted so that the user is able to free up disk space.
Method 1
- Press the keys Win+R, and a window ‘run’ will open. Input the code eventvwr.msc, and then press enter to run that Event Viewer.
- On the left pane, you will be able to expand the Window logs, and then click on one category.
- Select the entries that you will in the middle pane, and then choose a series of entries, press ctrl+shift+enter, and then click on the clear log option that appears.
Method 2
The second method is to use a command prompt for deleting Win log files.
You need to run the Command Prompt with administrative privileges, and then type three commands; after each command, press Enter.
- 1) cd/
- 2) cd windows
- 3) del*.log/a/s/q/f
3 Steps will delete the Win Log files on your PC.
The third method to delete Win Log files is to use a .CMD file. However, the coding for this is much complex and can be found online.
All you need to do is open your notepad on Windows 10, and run a command.
- In Windows 10, another method to delete the Win log files is to open the Event Viewer GUI.
- First, you need to open a Run dialog, and then tye ‘eventvmr.msc’ in it, and press ctrl+shift+enter.
- You can expand the folders that appear on your left side and then click on the ‘clear log’ option.
- You can repeat this option for all the entries that you want to delete.
- While Windows 10 is able to free up space automatically, the Event Viewer fails most of the time in the task of clearing the data automatically.
- In such cases, you will have to clear the event log in Windows 10 manually. There are some ways to delete log files in Windows 10.
How to Use Command Prompt to remove log files?
Here are some of the steps which you can follow to delete all of the Windows log files:
- Open an elevated command prompt. You can do this from the Windows search context menu, or you can also do this from a Run dialog (use the buttons Ctrl + Shift + Enter to launch cmd with admin privileges.
- Now, go to the even viewer default path which is mentioned above by using the change directory command:
cd%windir%\system32\config - Now, to clear all of the win log files, type the following command and then simply press Enter:
del *.log /a /s /q /f
All of the files with a .log extension will be deleted from your computer.
If you want to clear those log files individually, then here are the commands which you will need to enter:
- Open another admin command prompt.
- To list the log files, type the following command and press Enter:
wevtutil el - Now, from the list which appears, if you find a certain log file which you want to delete, type the following command and then press Enter:
wevtutil cl <name of the log>
This will delete that particular log from the Event Viewer file.
Read more: How To Make a Post Shareable on Facebook?
How to Make a Command File to Automatically Clear Log Files?
When you are trying out new experimental features, there is a chance that you may be generating a lot of win log files on your computer if the feature crashes.
In these cases, you might be wondering how to delete those win log files in Windows 10 automatically.
You can make a command file (.cmd) to mechanize this process. Follow these steps to create this command file:
- Open a text editor like Notepad or MS visual code.
- Type the following code, or copy and paste this following in the editor.
@echo off
FOR /F “tokens=1,2*” %%V IN (‘bcdedit’) DO SET adminTest=%%V
IF (%adminTest%)==(Access) goto admin
for /F “tokens=*” %%G in (‘wevtutil.exe el’) DO (call :do_clear “%%G”)
echo.
echo Event Logs have been cleared! ^<press any key^>
goto theEnd
:do_clear
echo clearing %1
wevtutil.exe cl %1
goto :eof
:noAdmin
echo You must run this script as an Administrator!
echo ^<press any key^>
:theEnd
pause>NUL
- Save the name of this command with the extension .cmd in any location which you prefer.
- Now, run this command file as an administrator, by choosing the correct option from the right-click context menu.
Read more: How To Disable Microsoft Family Features?
You will now see a command prompt windows will appear, and all of the log files are cleared automatically.
Note: Run this file as admin to clear event log files. Read more about CMD.