Preface
I don’t know if you have ever experienced it, because of the needs of working software or beautifying the system
"one by one"The fear of clicking to install font files has dominated< br>When I was tossing about the theme of Jopin, due to different themes and different fonts used, it often took a lot of time and energy to choose
『One by one』 , then click the font file to install
It’s okay not many, if you rely on more fonts, the process of installing fonts is simply a nightmare... ...
Fortunately, there is a better solution, freeing our hands, only one program, and a few paragraphs Little bat
code
Let's start!
1. Download the Fontreg.exe program
Fontreg.exe is an executable file without a graphical interface. It can help us copy, register and install font files
Combined with script code (bat, python... ), it can realize batch installation of font files
Click ☞Fontreg-2.1.3 address to download the compressed package
The compressed package of the font file you like, beauties~, or a single font file
Second, add Fontreg.exe to the environment variable
The environment variable sounds tall and can be simply understood as a program or file "shortcut Way"
It is convenient for us to call the "program or file" with shortcut added in any path
Under the Linux operating system, there is another good thing called "soft link", which is very similar to a shortcut. But don't confuse it with "environment variables"
For the convenience of running the script, we add the path of Fontreg.exe
obtained by decompression to the environment variable of the system
First, add Fontreg.exe< Copy the path where /code> is located.
The operating system I demonstrated is 64-bit, if your system is 32-bit, please copy the path information of
x:xxxx in.x86-32
Otherwise run it later script will fail
Then, add to the environment variable path
Remember to click
OK
one by one to make the modification take effect!
The relatively new win10 system environment variable entry is shown in the figure below, after opening it, add it according to the above steps
3. Writing scripts
Under the root directory of the decompressed font folder c:xxFont-ChironSansHKPro-ExtraLight
, right-click to create a new text document, and rename it to install_fonts.bat
Then right-click to open it through editing, copy and paste the following code into it, and save it.
At the end of the article "Read the original text", visit my blog and copy the relevant code
The second line of code is to add administrator privileges to the bat script, because the script needs to copy the font file to Under theC:WindowsFonts
directory of the system, higher permissions are required
For those who are interested in studying the source code of the script, you may find that I changed the third-to-last line
Yes, the script author did not addFontReg.exe
to the system Variables, so%cd%
is required, andFontReg.exe
needs to be run together with the script. I made some modifications on this basis.
Fourth, happy one-click font installation
Put
install_fonts.bat
in the root directory where the font file is locatedDouble-click
install_fonts.bat
The script will help us obediently, and change all the suffixes under the "current directory" and "subdirectory" to
*.ttf
,*.otf
font file
copy toC:WindowsFonts
directory
and install it to the system throughFontReg.exe
font registration tool is available for us to use.
For example, we first use this script to install the Font-ChironSansHKPro-ExtraLight
font, open C:WindowsFonts
before installation, you can see that there is no < code >ChironSansHKPro-ExtraLight
Place the script in the directory where the font is located, double-click to run:
After running, you can check whether the font is installed successfully!
The script will recursively check all subdirectories under the current directory, copy them one by one, and then install the fonts.
5. Fairy Tail
Although, in this way, it is very convenient to one-click install fonts
However, sometimes it is not necessary to install all fonts File
Unused fonts not only waste space (some font files are very large), but also affect the efficiency of font installation.
Of course, you can leave the required fonts, and then use the script to install the fonts, it is also possible
Sixth, dig a hole
Maybe you can use python
to write a program (command line? GUI?)
The purpose is to choose conveniently Fonts that need to be installed, and then one-click installation
What a beautiful thing~
Reference article
1.Introduction to the use of Fontreg.exe
2.autoinstall.bat
script source address
Articles are uploaded by users and are for non-commercial browsing only. Posted by: Lomu, please indicate the source: https://www.daogebangong.com/en/articles/detail/Finally%20found%20a%20way%20to%20install%20fonts%20in%20batches%20with%20one%20click.html
评论列表(196条)
测试