piett Posted December 23, 2005 Share Posted December 23, 2005 just found out how to use ftype.exe and assoc.exe.they are a part of windows so everyone has them @echo offmkdir "%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.Documentthis 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 More sharing options...
C.RAZY Posted December 24, 2005 Share Posted December 24, 2005 just found out how to use ftype.exe and assoc.exe.they are a part of windows so everyone has them @echo offmkdir "%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.Documentthis 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 As an addition, I'd use:@echo offmkdir "%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.DocumentTo fully support different languages Thanks for this!Greetings,C.RAZY Link to comment Share on other sites More sharing options...
piett Posted December 24, 2005 Author Share Posted December 24, 2005 ah thank you for the edit Link to comment Share on other sites More sharing options...
Solid as a rock Posted February 9, 2006 Share Posted February 9, 2006 You both: thanks!! Link to comment Share on other sites More sharing options...
Jedi82 Posted March 13, 2006 Share Posted March 13, 2006 greeeeeeeeeeeeeeeeeat, i'll try it soon Link to comment Share on other sites More sharing options...
Yzöwl Posted March 13, 2006 Share Posted March 13, 2006 Now for the fixesThe executable is usually named FoxitReader.exe not Foxit Reader.exeThe 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 oneIf the file to be copied cannot be found, that directory didn't need makingIf for any reason the directory creation fails, the file should not be copied and the registry should not be changedIf for any reason the file copy fails, the registry should not be changedIf for any reason the FTYPE command fails the ASSOC command shouldn't be runThe output of both FTYPE and ASSOC do not need echoing to the screenAs 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)):ENDNOWENDLOCAL &GOTO :EOF Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now