JSI Tip 9623. How can I prevent Internet Explorer from asking to download the Acrobat Reader .PDF file instead of just opening it?

I have scripted IEPDF.bat to prevent Internet Explorer from asking to download a .PDF file instead of just opening it in the browser.

The syntax for using IEPDF.bat is:

IEPDF

NOTE: IEPDF.bat uses REG.EXE, built into Windows XP, Windows Server 2003, and later, or installed from the Support Tools on the Windows 2000 CD-ROM.

IEPDF.bat contains:

@echo off
setlocal
set ext=.PDF
set key="NONE"
call :getext>nul 2>&1
if %key% EQU "NONE" goto err
set AR=N
call :getAE>nul 2>&1
if "%AR%" EQU "N" goto err1
call :upd>nul 2>&1
endlocal
goto :EOF
:getext
for /f "Tokens=3*" %%a in ('REG QUERY "HKCR\%ext%" /VE^|find "REG_SZ"') do (
 set key="HKCR\%%b"
)
goto :EOF
:getAE
for /f "Tokens=*" %%a in ('REG QUERY %key%') do (
 set AR=Y
)
goto :EOF
:upd
REG ADD %key% /V BrowseInPlace /T REG_DWORD /F /D 0
goto :EOF
:err
@echo IEPDF cannot find the HKCR\.PDF key.
endlocal
goto :EOF
:err1
@echo IEPDF cannot find the %key% key.
endlocal



Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish