To change the date you need admin permissions !
You can do it like echo 05.12.15|date
You can see how you can see how to get the date in a specific format and here you can see few tricks how to wait in batch .
Here's the script - (run it with admin privileges !):
@if (@X)==(@Y) @end /* jscript commend
@echo off
set "desired_date=03.12.15"
:: execute jscript part and get the date in a specific format
for /f "tokens=1-3 delims=- " %%A in ('cscript //E:JScript //nologo "%~f0"') do (
set fdate=%%C.%%B.%%A
)
rem echo %fdate%
::change date
echo %desired_date%|date
::wait 60 seconds
typeperf "\IPv4\Datagrams Received/sec" -si 60 -sc 1 >nul 2>nul
::return date to its original state
echo %fdate%|date
exit /b 0
end of jscript commend*/
function GetCurrentDate() {
// Today date time which will used to set as default date.
var todayDate = new Date();
todayDate = todayDate.getFullYear() + "-" +
("0" + (todayDate.getMonth() + 1)).slice(-2) + "-" +
("0" + todayDate.getDate()).slice(-2) + " " + ("0" + todayDate.getHours()).slice(-2) + ":" +
("0" + todayDate.getMinutes()).slice(-2);
return todayDate;
}
WScript.Echo(GetCurrentDate());