How to delete windows log files from command

When a significant event occurs in the system, such as a Windows update or an error, it is stored in a record by Windows for troubleshooting purposes. these records are stored in log files located in the core of Windows directory. Log files are also beneficial as a future reference in tracking system changes. However, with time, these log files build up and gobble up space on your hard drive. In case you find yourself running out of space, you may consider deleting the log files to free up space. In this short guide, we dive in and explore how you can delete Windows log files using command prompt.

Let's get started.

Step 1: Run Command prompt as Administrator

Windows command prompt, also abbreviated as cmd is a powerful administration tool that helps users perform administrative tasks. One such task is deleting or wiping away windows logs manually.

To start off, type cmd in the search bar as shown

type cmd in search bar

The Command prompt option will be displayed. Right-click and select 'Run as Administrator'.

run command prompt as Administrator

This launches the Windows command prompt as Administrator as seen below.

Administrator Command Prompt

Step 2: Delete Windows Log files

Once the Windows command prompt opens, type the command below to navigate to the Windows folder

cd /Windows

change directory to Window folder

Next, type the command below and hit ENTER

del *.log /a /s /q /f

In this command, the attribute  'a'  directs windows to delete all log files.  The attribute 's' triggers the removal of files from all subfolders,  the parameter  'q'  bypasses any prompts that ask for a Yes or No, and  'f' removes these files forcefully from the system.

delete windows log files

After pressing ENTER, Windows will start deleting system log files as shown

delete Windows log files


The log files which are being used by other processes cannot be deleted by this command and will require the termination of the processes before proceeding to delete them.  I addition, you can also use other third-party software tools to clear Windows log files such as CCleaner.


Periodic deleting of windows log files is considered safe especially when you are running out of disk space. It saves you a lot of hustle especially when you want to save huge files.