Run a windows batch file with argument from Windows Scheduler
<p>I want to run a batch file, which will accept a Date argument and perform some tasks. This activity has to be scheduled to run at a specified schedule. If it is required, we should also be able to run the task manually by providing the Date argument via a command.</p>

<p>Hence, I am trying to create a windows scheduled task. However, I'm stuck of how to provide the batch file with an argument. This will take care of the scheduled execution of the script.</p>

<p>To cater the requirement of manually running the task, at will, I shall be using schtasks command. I also want to understand, if it is possible to provide the arguments to the schtasks while executing?</p>

<p>Thus, to summarize my issue:
1. How to pass date argument to batch script in Windows schedule task?
2. How to dynamically pass the date argument to batch script when running scheduled task from command line?</p>

<p>I appreciate your suggestion, if there is a better way of implementing this.</p>

<p>Limitation:- The script can only be executed by a particular user of the server. While the task should be executed by any other user on the server with relevant privileges.</p>

<p>Server:- Windows 2012</p>

<p>Edit:- The Batch file to process the date variable is working fine. My question is pertaining to scheduling of this script. 
I have tried using Windows task scheduler, which invokes this script, however, I am unable to pass the date as an argument to the batch script. How can an argument (Current Date) be passed from Windows task to batch script? I am aware that I can use %%DATE and %%TIME in batch script, however, it does not solve my requirement to run the script for some other date.</p>