Page 1 of 1

batch file to open OLK folder in Windows!

Posted: 11 Apr 2007 12:15
by Synblade
Hello, short background here:

When opening an attachment in Outlook, then modifying it and clicking Save instead of Save As, Outlook will save the file in a directory in the temporary internet files folder. This directory is a hidden directory and it is randomly generated on each computer, and it's hard to find.

There is a way to find the folder by going to the registry key

Outlook 2003 HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Outlook\Security
Outlook 2007 HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook\Security

And it will display it, for example
"C:\\Documents and Settings\\XXXXXXX\\Local Settings\\Temporary Internet Files\\OLK20A\\"

I wrote a simple batch file to export that data into a text file on the desktop called olk.txt --

regedit /e "%USERPROFILE%\Desktop\olk.txt" "HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook\Security"

Here is what the text file looks like when opened:

Windows Registry Editor Version 5.00

"OutlookSecureTempFolder"="C:\\Documents and Settings\\XXXXXXX\\Local Settings\\Temporary Internet Files\\OLK20A\\"

What I want to do is to be able to take that path out of that text file somehow and either copy it to the clipboard or open the folder that it's in. Is that possible to do?

Posted: 11 Apr 2007 19:55
by DosItHelp
In order to avoid having to deal with the double \\ in the path and the extra temporary olk.txt file you could use the REG command like this:

Code: Select all

for /f "tokens=2,*" %%a in ('"reg query HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook\Security /v OutlookSecureTempFolder|find "OutlookSecureTempFolder" "') do (
    explorer "%%b"


Posted: 12 Apr 2007 15:08
by Synblade
That worked perfectly, thank you!