Can a batch file change the system date; save file with attributes; change date back to current date?
Goal to save MYFILE.TXT with the date of 01-01-2010
using Batch commands.
I have tried to set date=01-01-2010
and then save the file, but it didn't work.
Is this impossible?
@echo off
rem to Run this Batch file as administrator
date 01-01-2010
echo %date%
pause
echo Hello World > test.txt
date 09-08-2010
echo %date%
pause
goto :eof
Note: If we didn't "Run as Administrator" It creates an error message of "A required privilege is not held by the client."