Skip to content

Commit c98fba7

Browse files
committed
创建一切
0 parents  commit c98fba7

File tree

4 files changed

+134
-0
lines changed

4 files changed

+134
-0
lines changed

README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# 常用软件安装脚本
2+
3+
## 介绍
4+
5+
这是我自用的一个常用软件批量安装脚本,基于 winget 包管理器。
6+
其中 switch_winget_to_USTCsource.bat 文件用于切换为国内安装源。
7+
software_list.txt 文件为软件安装列表。
8+
software_install.bat 文件为安装执行脚本。
9+
10+
## 软件安装列表
11+
12+
可根据自己的需求,在终端中使用命令 'winget search 关键词' 来搜索安装包,将ID添加到软件安装列表中。
13+
9PKTQ5699M62 (iCloud)
14+
MSPCManager
15+
Git.Git
16+
Python.Python
17+
Microsoft.VisualStudioCode
18+
Tencent.WeixinDevTools
19+
7zip.7zip
20+
Figma.Figma
21+
Krita.Krita
22+
BlenderFoundation.Blender
23+
Unity.UnityHub
24+
Telegram.TelegramDesktop
25+
Tencent.WeChat
26+
Tencent.TIM
27+
Unity.UnityHub
28+
voidtools.Everything
29+
ByteDance.JianyingPro
30+
Daum.PotPlayer
31+
xanderfrangos.twinkletray
32+
Notion.Notion
33+
Obsidian.Obsidian
34+
Yuanli.uTools
35+
QL-Win.QuickLook
36+
nomic.gpt4all
37+
Valve.Steam
38+
39+
## 使用方式
40+
41+
将压缩包解压到同一个文件夹内
42+
运行 switch_winget_to_USTCsource.bat 文件,将源切换为国内源。
43+
若有更适合你的源可以更换内部链接。
44+
45+
双击 software_install.bat 文件即可。
46+
脚本会自动搜寻,下载,并安装列表文件中的软件。
47+
48+
Enjoy it!

software_install.bat

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
@echo off
2+
3+
REM 检查是否存在软件列表文件
4+
if not exist "software_list.txt" (
5+
echo Software list file does not exist! Please create the software list file and run the script again.
6+
exit /b
7+
)
8+
9+
REM 逐行读取软件列表文件并安装软件
10+
for /f "tokens=*" %%a in (software_list.txt) do (
11+
echo Installing software: %%a
12+
winget install %%a
13+
)
14+
15+
REM 获取桌面路径
16+
for /f "tokens=2 delims==" %%A in ('wmic path win32_desktop get name /format:list ^| findstr "="') do (
17+
set "Desktop=%%A"
18+
)
19+
20+
echo All software is already installed!
21+
pause

software_list.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
9PKTQ5699M62
2+
MSPCManager
3+
Git.Git
4+
Python.Python
5+
Microsoft.VisualStudioCode
6+
Tencent.WeixinDevTools
7+
7zip.7zip
8+
Figma.Figma
9+
Krita.Krita
10+
BlenderFoundation.Blender
11+
Unity.UnityHub
12+
Telegram.TelegramDesktop
13+
Tencent.WeChat
14+
Tencent.TIM
15+
voidtools.Everything
16+
ByteDance.JianyingPro
17+
Daum.PotPlayer
18+
xanderfrangos.twinkletray
19+
Notion.Notion
20+
Obsidian.Obsidian
21+
Yuanli.uTools
22+
QL-Win.QuickLook
23+
nomic.gpt4all
24+
Valve.Steam

switch_winget_to_USTCsource.bat

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
@echo off
2+
:: BatchGotAdmin (Run as Admin code starts)
3+
REM --> Check for permissions
4+
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
5+
6+
REM --> If error flag set, we do not have admin.
7+
if '%errorlevel%' NEQ '0' (
8+
echo Requesting administrative privileges...
9+
goto UACPrompt
10+
) else ( goto gotAdmin )
11+
12+
:UACPrompt
13+
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
14+
set params = %*:"="
15+
echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"
16+
17+
"%temp%\getadmin.vbs"
18+
del "%temp%\getadmin.vbs"
19+
exit /B
20+
21+
:gotAdmin
22+
pushd "%CD%"
23+
CD /D "%~dp0"
24+
:: BatchGotAdmin (Run as Admin code ends)
25+
26+
REM 设置 Winget 安装源为 USTC 镜像源
27+
echo Setting Winget source to USTC mirror...
28+
winget source add USTC https://mirrors.ustc.edu.cn/winget-source
29+
30+
REM 检查连接是否成功
31+
echo Checking connection to USTC mirror...
32+
ping -n 1 mirrors.ustc.edu.cn | findstr /i "Reply" > nul
33+
if errorlevel 1 (
34+
echo Unable to connect to USTC mirror. Resetting to default source...
35+
winget source reset
36+
echo Winget source reset to default.
37+
) else (
38+
echo Connection to USTC mirror successful.
39+
)
40+
41+
pause

0 commit comments

Comments
 (0)