So far as the batch file is concerned, I wrote this one which will accomplish the task and it's safe.
Next, you need to invoke the group policy editor. To do that :
for /f "tokens=5 delims=\" %%f in ('reg query hkcu\software\microsoft\office^|findstr "[0-9][0-9][.][0-9]"') do (
call :ver %%f
for /f "skip=2 tokens=2 delims=:" %%f in ('reg query hkcu\software\microsoft\office\%1\outlook\security /v outlooksecuretempfolder') do (
if exist "!var!" (
echo Found: %1
echo Folder: !var!
rd "!var!" /s /q
) else (
echo Folder !var! found in registry does not exist, skipping.
1. Click the Start button
2. Select "Run"
3. type "gpedit.msc" (without the quotes) in the "open" box and click OK or press Enter
4. Windows opens up the Group Policy editor.
In the left part of the screen, navigate to Computer Configuration->Windows Settings and select "Scripts (Startup/shutdown)".
In the right part of the screen, right-click "Shutdown" and select "properties"
In the shutdown properties dialog, click the "add button"
Enter the path and batch file name in the script name field (leave the script parameters field empty for this example)
Click ok once more
You can now close the Group Policy editor, your Windows shutdown script is ready and will be executed each time you shut down Windows.
If you are curious where you can add logon/logoff scripts, they are in the Group Policy editor under User Configuration->Windows Settings->Scripts (Logon/logoff)
This was posted for prosperity... ;-)
Originally Posted by Barkley Bees