install-pandoc.ps1 1.05 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Install miktex for latex support
Write-Output "Installing pandoc"

Write-Output "Downloading installer"
## download 
$url = "https://github.com/jgm/pandoc/releases/download/2.10.1/pandoc-2.10.1-windows-x86_64.zip"
$output = 'c:\Windows\Temp\pandoc.zip'
$wcR = New-Object System.Net.WebClient

Write-Output "Downloading $url"
#Download the exe
$wcR.DownloadFile($url, $output)
Write-Output "Download completed $url"

$pandocDir = 'C:\pandoc\'
Write-Output "Install $output into $pandocDir"
Jean-Francois Rey's avatar
Jean-Francois Rey committed
17
Expand-Archive -LiteralPath $output -DestinationPath $pandocDir -Force
18

Jean-Francois Rey's avatar
Jean-Francois Rey committed
19
if (Test-Path 'C:\pandoc\pandoc-2.10.1\pandoc.exe')
20
21
22
23
24
25
26
27
28
{
	Write-Output "pandoc installed"
}
else
{
	throw "ERROR: Can't install pandoc"
}
# Add pandoc to PATH
$oldpath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).path
Jean-Francois Rey's avatar
Jean-Francois Rey committed
29
$newPath = "$oldpath;C:\pandoc\pandoc-2.10.1\\"
30
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value $newPath
31
Remove-Item $output -Force