Last active
August 31, 2021 12:04
-
-
Save adotcoop/2c469db852467708cd0a2494712a82aa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ProgressPreference = 'SilentlyContinue' | |
mkdir C:\Apps -Force | |
# Download the bootstrapper | |
Invoke-WebRequest -UseBasicParsing -URI https://miktex.org/download/win/miktexsetup-x64.zip -OutFile C:\Apps\miktexsetup-x64.zip | |
Expand-Archive C:\Apps\miktexsetup-x64.zip -DestinationPath C:\Apps\miktex | |
# Call the bootstrapper to download the remaining source packages | |
$params = @{ | |
FilePath = "C:\Apps\miktex\miktexsetup_standalone.exe" | |
ArgumentList = "--package-set=essential --local-package-repository=C:\Apps\miktex download" | |
WindowStyle = "Hidden" | |
Wait = $True | |
PassThru = $True | |
Verbose = $True | |
} | |
$process = Start-Process @params | |
# Install MiKTeX | |
$params = @{ | |
FilePath = "C:\Apps\miktex\miktexsetup_standalone.exe" | |
ArgumentList = "--package-set=essential --local-package-repository=C:\Apps\miktex --shared=yes install" | |
WindowStyle = "Hidden" | |
Wait = $True | |
PassThru = $True | |
Verbose = $True | |
} | |
$process = Start-Process @params | |
# update the PATH so we can find the newly installed MiKTeX console executable | |
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") | |
# check for updates to suppress the error "the administrator hasn't yet checked for updates" | |
$params = @{ | |
FilePath = "mpm.exe" | |
ArgumentList = "--admin --find-updates" | |
WindowStyle = "Hidden" | |
Wait = $True | |
PassThru = $True | |
Verbose = $True | |
} | |
$process = Start-Process @params | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment