Save, Change then Rest Date to Saved Date

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
themathprof
Posts: 5
Joined: 20 Feb 2011 12:39

Save, Change then Rest Date to Saved Date

#1 Post by themathprof » 20 Feb 2011 12:45

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

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Save, Change then Rest Date to Saved Date

#2 Post by aGerman » 20 Feb 2011 13:40

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

themathprof
Posts: 5
Joined: 20 Feb 2011 12:39

Re: Save, Change then Rest Date to Saved Date

#3 Post by themathprof » 20 Feb 2011 14:10

Thank you.
Your code worked great.
theMathProf

Post Reply