Create windows 2003 shortcut or MKLINK based on current date?
I need to create a symlink/shortcut on the prod servers that will alias:
agent_ivr_general_info.开发者_Python百科CURRENT
to
agent_ivr_general_info.[todays date].log
because I have daily rolling logs cush as:
agent_ivr_general_info.2011-04-28.log
That I want to just open 1 LINK to get to CURRENT.
Hmm... I suppose one technique would be to use Sysinternals' JUNCTION.EXE with a Scheduled Task that runs daily just after midnight, and uses something like the following to change the link:
cd TARGET_DIRECTORY
:: get date -- this only works for default US date, YMMV
set day=%DATE:~7,2%
set month=%DATE:~4,2%
set year=%DATE:~-4%
:: set %today% formatted as YYYY-MM-DD
set today=%year%-%month%-%day%
:: delete old link
junction -d CURRENT
:: create new one
junction -c CURRENT .\%today%
精彩评论