Click here to Skip to main content
13,291,503 members (70,754 online)
Click here to Skip to main content
Add your own
alternative version


1 bookmarked
Posted 7 Mar 2014

ZIP or Archive and Delete Old Log Files using Windows Task Scheduler in Winrar

, 7 Mar 2014
Rate this:
Please Sign up or sign in to vote.
Zip or Archive and delete old log files using Windows Task Scheduler in Winrar


Sometimes, we need to delete temporary files or old log files or text files using some service of Windows Task Scheduler. Today, I am going to discuss how to create Task Scheduler in Windows and archive old log files.


In your computer, Winrar software should be installed. We only need to create a batch file and execute some command in the batch file.

Using the Code

Set Windows Environmental variable to point to installed Winrar application

  • Right click on My Computer to open popup
  • Click Properties to open the dialog box
  • Click on Advance system settings to open System properties dialog box
  • Click on Advance tab, click on Environmental variables button to open a dialog box
  • Select “Path” variable from the below pane and click Edit button to open a dialog box
  • Append the following at the end of the text box:

    ;C:\Program Files\WinRAR (included semicolon also) – This is the path where your actual Winrar application is installed

  • Click OK, Click OK, Click OK

Now open Notepad and add the following contents in that


Eg. WinRAR a -r C:\ C:\Test.txt

cd DIRNAME (directory from where you will delete log files)


Now, save the file as “Test.bat

Now let's configure Windows Task Scheduler.

Configure Task Scheduler

  • Click Start menu
  • Find Task Scheduler, click to open to Task Scheduler Window
  • Click Create Basic Task to open a dialog box
  • Type TestScheduler in text box. Click Next button
  • Select “Daily” radio button
  • Click Next
  • Set Start time of the task to start
  • Click Next
  • Select “Start a program” radio button
  • Click Next
  • Click Browse and select Test.bat
  • Click Next, Click Finish

Now you are ready to go. Happy coding!!!


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Asia/Pacific Region Asia/Pacific Region
No Biography provided

You may also be interested in...


Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.171207.1 | Last Updated 7 Mar 2014
Article Copyright 2014 by Partha_sarathi_ghosh
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid