JSI Tip 9622. How can a script configure specific office file extensions to open in their own application instead of in Internet Explorer?

In tip 2300 » Office documents open in Internet Explorer instead of the office application, we manually configured the registry.

I have scripted OpenInOwnApp.bat to configure the registry for the office file extensions you specify.

The syntax for using OpenInOwnApp.bat is:

OpenInOwnApp .EXT1 \[.EXT2 .. .EXTn\]

Where each .EXTX is an office file extension, like .DOC and .XLS, etc..

NOTE: OpenInOwnApp.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.

OpenInOwnApp.bat contains:

@echo off
if \{%1\}

\{\} goto err :loop if \{%1\}

\{\} goto finish set ext=%1 shift set key="NONE" call :getext>nul 2>&1 if %key% EQU "NONE" goto err set /a BrowserFlags=0 call :getbf>nul 2>&1 set /a work=%BrowserFlags% ^& 8 if %work% EQU 8 goto loop set /a BrowserFlags=%BrowserFlags% + 8 call :upd>nul 2>&1 goto loop :getext for /f "Tokens=3*" %%a in ('REG QUERY "HKCR\%ext%" /VE^|find "REG_SZ"') do ( set key="HKCR\%%b" ) goto :EOF :getbf for /f "Tokens=3" %%a in ('REG QUERY %key% /V BrowserFlags^|find "REG_DWORD"') do ( set /a BrowserFlags=%%a ) goto :EOF :upd REG ADD %key% /V BrowserFlags /T REG_DWORD /F /D %BrowserFlags% goto :EOF :err @echo Syntax: OpenInOwnApp .EXT1 \[.EXT2 .. .EXTn\] goto :loop :finish endlocal

Hide 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.