-
Notifications
You must be signed in to change notification settings - Fork 0
/
b安装-普通.ps1
34 lines (29 loc) · 1.3 KB
/
b安装-普通.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Encoding: GB2312
# Please use normal ps.
Write-Host "当前时间:$(Get-Date)"
$startTime = Get-Date
# 修改电源设置
Write-Output "修改电源设置……"
powercfg /change standby-timeout-ac 0 # 设置电脑不睡眠
powercfg /change hibernate-timeout-ac 0 # 设置电脑不休眠
# MikTeX配置
winget install -e --id MiKTeX.MiKTeX
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
# 暂时换成南大镜像
mpm --set-repository=https://mirrors.nju.edu.cn/CTAN/systems/win32/miktex/tm/packages/
# mpm --set-repository=https://mirrors.sjtug.sjtu.edu.cn/ctan/systems/win32/miktex/tm/packages/
Write-Output "MiKTeX: 升级软件包..."
miktex packages update-package-database
miktex packages update
# Write-Output "MiKTeX: 安装剩余软件包..."
# TODO: 文件待更新: ".\其他脚本\安装\MiKTeX-packages.txt"
# miktex packages require --package-id-file=".\其他脚本\安装\MiKTeX-packages.txt"
Write-Output "MiKTeX: 添加用户文件夹..."
initexmf --register-root="D:\Google 云端硬盘\资料\30 Latex\全局可见宏包"
initexmf --update-fndb # miktex fndb refresh
initexmf --enable-installer # 自动安装缺失宏包
Write-Output "MiKTeX: 已完成..."
$endTime = Get-Date
$duringTime = $endTime - $startTime
Write-Output "耗时:$($duringTime.TotalMinutes)分钟"
pause