Jump to content

Foxit batch installer the easy way :)


piett

Recommended Posts

just found out how to use ftype.exe and assoc.exe.

they are a part of windows so everyone has them :)

@echo off
mkdir "%systemdrive%\Program Files\Foxit Reader\"
copy "Foxit Reader.exe" "%systemdrive%\Program Files\Foxit Reader\Foxit Reader.exe"

FTYPE FoxitReader.Document="%systemdrive%\Program Files\Foxit Reader\Foxit Reader.exe" "%1"
ASSOC .pdf=FoxitReader.Document

this will create a Foxit Reader folder in Program Files.

next it will copy the foxit exe to it.

and then it will use ftype.exe and assoc.exe to make it default for pdf files :)

Link to comment
Share on other sites


just found out how to use ftype.exe and assoc.exe.

they are a part of windows so everyone has them :)

@echo off
mkdir "%systemdrive%\Program Files\Foxit Reader\"
copy "Foxit Reader.exe" "%systemdrive%\Program Files\Foxit Reader\Foxit Reader.exe"

FTYPE FoxitReader.Document="%systemdrive%\Program Files\Foxit Reader\Foxit Reader.exe" "%1"
ASSOC .pdf=FoxitReader.Document

this will create a Foxit Reader folder in Program Files.

next it will copy the foxit exe to it.

and then it will use ftype.exe and assoc.exe to make it default for pdf files :)

Excellent! Just what I was in search for right now :thumbup

As an addition, I'd use:

@echo off
mkdir "%PROGRAMFILES%\Foxit Reader\"
copy "Foxit Reader.exe" "%PROGRAMFILES%\Foxit Reader\Foxit Reader.exe"

FTYPE FoxitReader.Document="%PROGRAMFILES%\Foxit Reader\Foxit Reader.exe" "%1"
ASSOC .pdf=FoxitReader.Document

To fully support different languages :)

Thanks for this!

Greetings,

C.RAZY

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

Now for the fixes

  • The executable is usually named FoxitReader.exe not Foxit Reader.exe
    The additional parameter at the end of the exe name in the registry should read "%%1" not "%1" when invoked from a batch file.
    You should really check if a directory exists before making a new one
    If the file to be copied cannot be found, that directory didn't need making
    If for any reason the directory creation fails, the file should not be copied and the registry should not be changed
    If for any reason the file copy fails, the registry should not be changed
    If for any reason the FTYPE command fails the ASSOC command shouldn't be run
    The output of both FTYPE and ASSOC do not need echoing to the screen

As the location of the executable is changeable as is the destination of the file on your system, give the user an easier opportunity to change those to their own requirements first!

@ECHO OFF &SETLOCAL ENABLEEXTENSIONS

:: source file /folder location relative to this files location
(SET FXREAD=Foxit Reader\FoxitReader.exe)

:: your required destination folder name and location
(SET MYDEST=%PROGRAMFILES%\Foxit Reader)

IF NOT EXIST %FXREAD% (GOTO ENDNOW)
IF NOT EXIST %MYDEST% (MD %MYDEST%||GOTO ENDNOW)
COPY "%FXREAD%" "%MYDEST%" &&(
FOR %%? IN ("%FXREAD%") DO (SET FULLDEST=%MYDEST%\%%~nx?)
FTYPE FoxitReader.Document="%FULLDEST%" "%%1">NUL 2>&1 &&(
ASSOC .pdf=FoxitReader.Document>NUL))
:ENDNOW
ENDLOCAL &GOTO :EOF

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...