Page 1 of 1

Save, Change then Rest Date to Saved Date

Posted: 20 Feb 2011 12:45
by themathprof
The last line does not save the date.
Can someone help?
I save date (after truncating the weekday)
Then Change Date
Finally, I want to reset date to original.

Thanks.

Cd C:\Program Files\Microsoft Office\Office12\
set currentsysdate=%date:~-10%
Date = 02-02-11
Start /max /wait WINWORD.EXE
Set Date = CurrentSysDate

Re: Save, Change then Rest Date to Saved Date

Posted: 20 Feb 2011 13:40
by aGerman
The command to change the system date is not date = ... and also not set date = .... It's simply date ....

Code: Select all

Cd "C:\Program Files\Microsoft Office\Office12"
set "CurrentSysDate=%date:~-10%"
Date 02-02-11
Start /max /wait WINWORD.EXE
Date %CurrentSysDate%

On Win7 you have to run the batch as administrator, normal clients have no rights to change the system date.

Regards
aGerman

Re: Save, Change then Rest Date to Saved Date

Posted: 20 Feb 2011 14:10
by themathprof
Thank you.
Your code worked great.
theMathProf