-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAddVi_installer.bat
More file actions
125 lines (103 loc) · 5.44 KB
/
Copy pathAddVi_installer.bat
File metadata and controls
125 lines (103 loc) · 5.44 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
:: Version 20231028
@echo off
:: Suggested installation path
set "suggested_install_path=%userprofile%\AddVi"
:: Ask the user where to install
set /p "install_path=Enter installation path [%suggested_install_path%] (press Enter to accept): "
if "%install_path%"=="" set "install_path=%suggested_install_path%"
set "install_path=%install_path%"
:: Check if the specified directory exists; create it if it doesn't
if not exist "%install_path%" (
echo Directory does not exist. Creating the directory...
mkdir "%install_path%"
)
:: Download AddVi.bat
echo Downloading AddVi.bat...
curl -o "%install_path%\AddVi.bat" "https://raw.githubusercontent.com/vangquan/scripts/main/AddVi.bat"
:: Check if the download was successful
if %errorlevel% neq 0 (
echo Failed to download AddVi.bat. Please check the URL and try again.
pause
exit /b 1
)
:: Download NotoSans-Bold.ttf
set "fontPath=%LocalAppData%\Microsoft\Windows\Fonts\"
if not exist "%fontPath%" (
mkdir "%fontPath%"
echo Downloading NotoSans-Bold.ttf...
curl -o "%fontPath%\NotoSans-Bold.ttf" "https://b.jw-cdn.org/fonts/noto-sans/2.007-edcd458/hinted/NotoSans-Bold.ttf"
) else (
echo Font NotoSans-Bold.ttf is available in %LocalAppData%\Microsoft\Windows\Fonts.
)
:: Inform the user
echo AddVi.bat has been downloaded to "%install_path%" and NotoSans-Bold.ttf has been installed.
:: Define the temporary directory and FFmpeg download URL
set "temp_dir=%temp%\ffmpeg_temp"
set "ffmpeg_url=https://www.gyan.dev/ffmpeg/builds/ffmpeg-git-essentials.7z"
:: Check if ffmpeg.exe is available
where ffmpeg > nul 2>&1
if %errorlevel% neq 0 (
echo FFmpeg is not available. Downloading and installing...
:: Create the temporary directory if it doesn't exist
if not exist "%temp_dir%" mkdir "%temp_dir%"
:: Download FFmpeg 7z archive
curl -L -o "%temp_dir%\ffmpeg-git-essentials.7z" "%ffmpeg_url%"
:: Check if the download was successful
if exist "%temp_dir%\ffmpeg-git-essentials.7z" (
:: Extract FFmpeg executables from the 7z archive to the temporary directory
tar -xf "%temp_dir%\ffmpeg-git-essentials.7z" -C "%temp_dir%"
:: Find and copy ffmpeg.exe to the specified installation path
for /r "%temp_dir%" %%F in (*) do (
if "%%~nxF"=="ffmpeg.exe" (
copy "%%F" "%install_path%"
)
)
echo FFmpeg has been downloaded and installed to "%install_path%"
) else (
echo Failed to download FFmpeg.
)
) else (
echo FFmpeg.exe is available and ready to run.
)
:: Create a shortcut of AddVi.bat in %APPDATA%\Microsoft\Windows\SendTo
set "sourceFile=%install_path%\AddVi.bat"
set "sendToDir=%APPDATA%\Microsoft\Windows\SendTo"
:: Define the shortcut name
set "shortcutName=AddVi.lnk"
:: Create the shortcut
set "target=%sendToDir%\%shortcutName%"
echo Set oWS = WScript.CreateObject("WScript.Shell") > "%temp%\CreateShortcut.vbs"
echo sLinkFile = "%target%" >> "%temp%\CreateShortcut.vbs"
echo Set oLink = oWS.CreateShortcut(sLinkFile) >> "%temp%\CreateShortcut.vbs"
echo oLink.TargetPath = "%sourceFile%" >> "%temp%\CreateShortcut.vbs"
echo oLink.Save >> "%temp%\CreateShortcut.vbs"
cscript /nologo "%temp%\CreateShortcut.vbs"
del "%temp%\CreateShortcut.vbs"
:: Inform the user
echo Shortcut created: "%target%"
:: End of the script
:: ASCII outro
cls
:::
::: ________ ________ ________ ___ ___ ___
::: |\ __ \|\ ___ \|\ ___ \|\ \ / /|\ \
::: \ \ \|\ \ \ \_|\ \ \ \_|\ \ \ \ / / | \ \
::: \ \ __ \ \ \ \\ \ \ \ \\ \ \ \/ / / \ \ \
::: \ \ \ \ \ \ \_\\ \ \ \_\\ \ \ / / \ \ \
::: \ \__\ \__\ \_______\ \_______\ \__/ / \ \__\
::: \|__|\|__|\|_______|\|_______|\|__|/ \|__|
:::
:::
:::
::: ___ ________ ________ _________ ________ ___ ___ _______ ________ ___
::: |\ \|\ ___ \|\ ____\|\___ ___\\ __ \|\ \ |\ \ |\ ___ \ |\ ___ \|\ \
::: \ \ \ \ \\ \ \ \ \___|\|___ \ \_\ \ \|\ \ \ \ \ \ \ \ \ __/|\ \ \_|\ \ \ \
::: \ \ \ \ \\ \ \ \_____ \ \ \ \ \ \ __ \ \ \ \ \ \ \ \ \_|/_\ \ \ \\ \ \ \
::: \ \ \ \ \\ \ \|____|\ \ \ \ \ \ \ \ \ \ \ \____\ \ \____\ \ \_|\ \ \ \_\\ \ \__\
::: \ \__\ \__\\ \__\____\_\ \ \ \__\ \ \__\ \__\ \_______\ \_______\ \_______\ \_______\|__|
::: \|__|\|__| \|__|\_________\ \|__| \|__|\|__|\|_______|\|_______|\|_______|\|_______| ___
::: \|_________| |\__\
::: \|__|
:::
for /f "delims=: tokens=*" %%A in ('findstr /b ::: "%~f0"') do @echo(%%A
pause