@echo off rem set path set path=%~dp0texmf\miktex\bin;%path% rem test whether a lock entry exists in the Registry reg query HKCU\Software\TeX-portable 2>nul 1>nul && ( echo %~nx0' can be run only once per session, run `reset.bat' first! echo. pause exit ) cls echo Please wait... rem set version numbers call "%~dp0versions.bat" rem add lock entry to the Registry reg add HKCU\Software\TeX-portable /f 2>nul 1>nul rem create folder context menu item for opening a DOS command line reg add "HKCU\Software\Classes\Folder\shell\ZCmdHere" /ve /t REG_SZ /d "Command Prompt Here" /f 1>nul 2>nul reg add "HKCU\Software\Classes\Folder\shell\ZCmdHere\command" /ve /t REG_SZ /d "\"%~dp0cmd.bat\" \"%%1\"" /f 1>nul 2>nul rem create file context menu item for opening a DOS command line reg add "HKCU\Software\Classes\*\shell\ZCmdHere" /ve /t REG_SZ /d "Command Prompt Here" /f 1>nul 2>nul reg add "HKCU\Software\Classes\*\shell\ZCmdHere\command" /ve /t REG_SZ /d "\"%~dp0cmd.bat\" \"%%1\"" /f 1>nul 2>nul rem backup existing .dvi entry reg query HKCU\Software\Classes\.dvi 2>nul 1>nul && ( reg copy HKCU\Software\Classes\.dvi HKCU\Software\Classes\.dvi.bak /f /s 2>nul 1>nul ) rem create new (private) file association for .dvi reg add HKCU\Software\Classes\.dvi /ve /d "my_dvifile" /f 2>nul 1>nul reg add HKCU\Software\Classes\my_dvifile\shell\open\command /ve /d "\"%~dp0texmf\miktex\bin\yap.exe\" \"%%1\"" /f 2>nul 1>nul reg add HKCU\Software\Classes\my_dvifile\DefaultIcon /ve /d "\"%~dp0texmf\miktex\bin\yap.exe\"" /f 2>nul 1>nul rem backup existing .ps/.eps entries reg query HKCU\Software\Classes\.ps 1>nul 2>nul && ( reg copy HKCU\Software\Classes\.ps HKCU\Software\Classes\.ps.bak /s /f 2>nul 1>nul ) reg query HKCU\Software\Classes\.eps 1>nul 2>nul && ( reg copy HKCU\Software\Classes\.eps HKCU\Software\Classes\.eps.bak /s /f 2>nul 1>nul ) rem create new (private) file associations for .ps/.eps reg add HKCU\Software\Classes\.ps /ve /d "my_psfile" /f 2>nul 1>nul reg add HKCU\Software\Classes\.eps /ve /d "my_psfile" /f 2>nul 1>nul reg add HKCU\Software\Classes\my_psfile\shell\open\command /ve /d "\"%~dp0Ghostgum\gsview\gsview32.exe\" \"%%1\"" /f 2>nul 1>nul reg add HKCU\Software\Classes\my_psfile\DefaultIcon /ve /d "\"%~dp0Ghostgum\gsview\gsview32.ico\"" /f 2>nul 1>nul rem backup existing gsview32.ini file in the %USERPROFILE% directory if exist "%USERPROFILE%\gsview32.ini" ( del "%USERPROFILE%\gsview32.ini.bak" 1>nul 2>nul ren "%USERPROFILE%\gsview32.ini" gsview32.ini.bak 1>nul 2>nul ) rem write gsview32.ini file on USB drive echo [GSview-%GSVIEW_VERSION%]> "%~dp0Ghostgum\gsview\gsview32.ini" echo Configured=1 >> "%~dp0Ghostgum\gsview\gsview32.ini" echo Version=%GSVIEW_VERSION%>> "%~dp0Ghostgum\gsview\gsview32.ini" echo GhostscriptDLL=%~dp0gs\gs%GS_VERSION%\bin\gsdll32.dll>> "%~dp0Ghostgum\gsview\gsview32.ini" echo GhostscriptEXE=%~dp0gs\gs%GS_VERSION%\bin\gswin32c.exe>> "%~dp0Ghostgum\gsview\gsview32.ini" echo GhostscriptInclude=%~dp0gs\gs%GS_VERSION%\lib;%~dp0gs\fonts;%~dp0gs\gs%GS_VERSION%\Resource>> "%~dp0Ghostgum\gsview\gsview32.ini" echo GhostscriptOther=-dNOPLATFONTS -sFONTPATH="c:\psfonts">> "%~dp0Ghostgum\gsview\gsview32.ini" echo. >> "%~dp0Ghostgum\gsview\gsview32.ini" rem append GSview settings from last session if exist "%~dp0.gsview32.ini" ( type "%~dp0.gsview32.ini" >> "%~dp0Ghostgum\gsview\gsview32.ini" ) rem backup existing MiKTeX settings for later restore reg query HKCU\Software\MiKTeX.org\MiKTeX\%MIKTEX_VERSION% 1>nul 2>nul && ( reg copy HKCU\Software\MiKTeX.org\MiKTeX\%MIKTEX_VERSION% HKCU\Software\MiKTeX.org\MiKTeX\%MIKTEX_VERSION%.bak /s /f 1>nul 2>nul ) reg query HKLM\Software\MiKTeX.org\MiKTeX\%MIKTEX_VERSION% 1>nul 2>nul && ( reg copy HKLM\Software\MiKTeX.org\MiKTeX\%MIKTEX_VERSION% HKCU\Software\MiKTeX.org\MiKTeX\%MIKTEX_VERSION%.bak /s /f 1>nul 2>nul ) rem load MiKTeX settings from previous session if exist "%~dp0.MiKTeX.reg" ( reg import "%~dp0.MiKTeX.reg" 1>nul 2>nul ) rem on startup, don't let Yap check whether it is the default viewer (this breaks the .dvi file association) reg add HKCU\Software\MiKTeX.org\MiKTeX\%MIKTEX_VERSION%\Yap\Settings /v "Check Associations" /d 0 /t REG_DWORD /f 1>nul 2>nul rem initialize MiKTeX reg add HKCU\Software\MiKTeX.org\MiKTeX\%MIKTEX_VERSION%\Core /v "Install" /d "%~dp0texmf" /t REG_SZ /f 1>nul 2>nul reg add HKCU\Software\MiKTeX.org\MiKTeX\%MIKTEX_VERSION%\Core /v "Roots" /d "%~dp0localtexmf;%~dp0texmf" /t REG_SZ /f 1>nul 2>nul reg add HKCU\Software\MiKTeX.org\MiKTeX\%MIKTEX_VERSION%\Core /v "UserData" /d "%~dp0.userdata" /t REG_SZ /f 1>nul 2>nul reg add HKCU\Software\MiKTeX.org\MiKTeX\%MIKTEX_VERSION%\Core /v "UserConfig" /d "%~dp0.userconfig" /t REG_SZ /f 1>nul 2>nul initexmf.exe --verbose --dump --mklinks initexmf.exe --verbose --mkmaps initexmf.exe --verbose --update-fndb cls echo. echo The portable MiKTeX/GS/GSview installation is now ready for use! echo. echo ********************************************************************* echo ** IMPORTANT: Don't forget to run reset.bat' before disconnecting ** echo ** the USB drive! ** echo ********************************************************************* echo. pause