ZTree.com  | ZEN  | About...  

 Index   Back

Better solution for running Acrobat as Administrator   [Help!]

By: John Gruener     Orlando, Florida  
Date: May 15,2023 at 02:27
In Response to: [Help!] Odd PDF problem (Zdenek Hladik)

Hi Zdenek,

Thanks for your solution to this problem. Obviously you put in a considerable amount of effort and testing to work it out.

As a result I began digging deeper into it.

The first thing I discovered is that, even with its Protected Mode enabled at startup, Acrobat Reader can still be started successfully when it is Run as Administrator outside of ZTree, and will successfully open any PDF file. So this pointed to the possibility of some unique ZTree problem.

I then discovered that when ZTree is installed under %ProgramFiles% and run in Administrator mode, Acrobat successfully starts and opens the PDF, even with Protected Mode enabled!

So that put me on the hunt for the difference between running ZTree as Admin under %ProgramFiles% and running it from elsewhere, each with identical settings and configuration files.

Finally I discovered the difference: When running as Admin outside of %ProgramFiles%, an environment variable __COMPAT_LAYER=Installer is set. When running the same under %ProgramFiles% this variable is not set.

To test whether this was the cause, I created the following PDF.BAT file in #ZTHome, using your lines to find Acrobat:



@echo off
if exist "%programfiles(x86)%\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe" set PDFRdr=%programfiles(x86)%\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe
if exist "%programfiles%\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe" set PDFRdr=%programfiles%\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe
if exist "%programW6432%\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe" set PDFRdr=%programW6432%\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe
if exist "%programfiles%\Adobe\Acrobat DC\Acrobat\Acrobat.exe" set PDFRdr=%programfiles%\Adobe\Acrobat DC\Acrobat\Acrobat.exe
if exist "%programW6432%\Adobe\Acrobat DC\Acrobat\Acrobat.exe" set PDFRdr=%programW6432%\Adobe\Acrobat DC\Acrobat\Acrobat.exe

if "%PDFRdr%x"=="x" (
echo Acrobat Reader program not found. Press any key to exit...
pause >nul
goto eof
)

set __COMPAT_LAYER=
start "" "%PDFRdr%" %1


Voila! It works. Eliminating that variable is all that's needed.

So, Kim:
Is ZTree setting the __COMPAT_LAYER variable?
If so, why is it needed, and what would not work without it?
And why is it set only if run as Admin outside of %ProgramFiles%?

- John
308 views      
 

Messages in this Thread

 
96,656 Postings in 12,233 Threads, 350 registered users, 23 users online (0 registered, 23 guests)
Index | Admin contact |   Forum Time: May 12, 2024 - 11:26 pm UTC  |  Hits:63,418,765  (20,676 Today )
RSS Feed