We have shown the steps to create a .bat script to delete certain files older than six months for your information. However, you can customize it as per your requirements. To get started, open the Notepad or any other text editor you have on your computer and paste the following text: Before saving, you have to make a few changes in the aforementioned lines. For example, in the first line, you have to enter the drive letter or network drive and the exact folder path you want to delete by replacing the network-folder-path text. In the second line, replace G with the original drive letter and 180 with the time you want. It is being calculated in day format. In the third line, replace the drive letter with your original drive letter. Once done, click on the File > Save As button.

Then, choose a file with .bat extension, select All Files from the Save as type drop-down list, and click the Save button. After that, you can move the .bat file to a place and keep it there. Once you are done with these aforementioned steps, you can create the task using Task Scheduler.

How to schedule ForFiles command on Shared Network drive

To schedule ForFiles command on a shared network in Windows 10, follow these steps: To get started, search for task scheduler and click on the individual result to open the Task Scheduler app on your computer. Select the Task Scheduler Library on the left side and click on the Create Task option on the right side.

Enter a name for your task and make sure that the Windows 10 option is selected in the Configure for drop-down list. Switch to the Triggers tab, and click on the New button to create a new trigger for your task.

Now, choose On a schedule from the Begin the task drop-down list, select Monthly, and choose a date and month.

Click the OK button, switch to the Actions tab, and click on the New button to create the action for your task.

Make sure the Start a program option is selected in the Action drop-down list. Then, click on the Browse button, and choose the .bat script you created earlier.

Click on the OK button to save the change. There is one important setting you should turn on. It is called Run task as soon as possible after a scheduled start is missed. Let’s assume that your computer fails to run a scheduled task at a particular time on a specific date. If you enable this setting, it will run the task whenever it gets time, followed by the missed schedule. You can find this option in the Settings tab. All you need to is to make a tick in a checkbox and click the OK button. As long as you do not delete the script or change the network drive letter, you can use this method to schedule the ForFiles command on a shared network folder on Windows 10.