Doing everything I explain below will automatically delete WoW's Cache folder every time you exit WoW for Windows 7 only. It may work for XP and/or 8, but I am unaware of any specific differences.
Everything in red may be different for you. Change accordingly.
Deleting the cache folder not only avoids any rare but possible issues WoW may have, but it is required for addons such as NPCscan in order to track creatures and NPCs properly.
This was originally part of a guide to auto-update The Undermine Journal data I posted on stormspire.net, but since TUJ has shut down, the guide was moved to a publicly inaccessible area and I wanted to show this specific cache part to a friend without them needing a stormspire account and without me changing all the vbulletin formatting, so here it is. I hope I can keep this post here and that other people benefit from it as well.
1) Make a file in your main WoW directory named wowcache.bat.
2) Right click that file, open with Notepad. If you have Notepad++, use that.
a) Paste the following in the wowcache.bat file. Save and close.
Warning: Only set this Cache folder. Do not delete the one found in the Data folder.
Note: RD is the part that deletes the Cache folder, everything before it checks if there's another game running before deleting. This is to prevent deleting if, say, you're RaFing yourself or are a multiboxer.
3) Press Win+R, type "secpol.msc", and hit Enter.
a) Click "Local Policies" on the left, then "Audit Policy", then double click "Audit process tracking".
f) Click the "XML" tab, check the "Edit query manually" box on the bottom, then click "Yes" on the popup.
Paste the following code into that box, then click OK and OK again.
<Query Id="0" Path="Security">
<Select Path="Security">*[System[(EventID=4689)]] and *[EventData[Data[@Name="ProcessName"]="C:\Program Files\World of Warcraft\Wow.exe" or Data[@Name="ProcessName"]="C:\Program Files\World of Warcraft\Wow-64.exe"]]</Select>
g) There's no other required options, other than naming the task. My options are below.
1. This step is definitely not needed. 3a. Use the following instead. It only deletes the necessary file for each region and as long as the batch file is saved in WoW's root directory, there is no need to edit it.
FOR /F "delims=\" %%G IN ("%~dp0") DO %%G
FOR /F "tokens=*" %%G IN ("DIR /B /AD .\Cache\WDB") DO DEL /Q /F .\Cache\WDB\%%G\creaturecache.wdb
4. Press Win+R, type "secpol.msc", and hit Enter. 5. Press Win+R, type "taskschd.msc", and hit Enter. 5f. Use the following instead:
<Query Id="0" Path="Security">
<Select Path="Security">*[System[(EventID=4689)]] and *[EventData[Data[@Name="ProcessName"]="[COLOR="Red"]C:\Program Files\[/COLOR]World of Warcraft\Wow.exe" or Data[@Name="ProcessName"]="[COLOR="red"]C:\Program Files\[/COLOR]World of Warcraft\Wow-64.exe"]]</Select>
_NPCScan and the like will no longer work with Warlords of Draenor, so this won't be useful in the near future.
This works on Windows Vista/7/8.
It's possible to hide the console window from showing with hidcon and other such utilities. You can also accomplish this by just changing the user running the task to SYSTEM.
I appreciate the tips. I would like to point out that no console windows pop up for me though. Batch files don't show console windows when Task Manager runs them. As I stated in the beginning, I have a much more complicated setup for updating TUJ when WoW starts which consists of a vbs calling a ps1 which also calls a bat. This is because the ps1 can't be hidden without the vbs hiding it.
As for Wowhead and WoWDB, this means that no delay is required and I can run this and my other scripts as soon as WoW exits?
I would like to point out that no console windows pop up for me though. Batch files don't show console windows when Task Manager runs them.
If the task is set to run as the current user, console windows definitely aren't hidden without using workarounds. However, you can also change the user running the task to SYSTEM, and nothing will appear on your screen.
I understand where you're coming from, but using this, I now have to have a shortcut to WoW. I use the bnet launcher completely, which is why I thought it was neat when I found out Task Scheduler can do things based on processes starting or exiting.
Just to clarify why I posted this thread, I just needed a WoW forum using vbulletin in order to post this cache portion of the full post I linked on stormspire. Too lazy to reformat for another forum other than changing highlight colors. It's all bbcode, but didn't want to mess with it if something was off. When or if TUJ comes back or a replacement starts up, I have other code that will auto update my auction data when WoW starts, as well as two other batch files that sort all my chat log files and move any screenshots to another folder.