新装 Windows 系统后的配置

移动用户目录

  • 在 D 盘新建mv.bat文件,mv.bat文件如下代码所示
  • win键+R 打开运行,输入shutdown -O -r -t 0进入 OOBE
  • 进入疑难解答,命令行窗口
  • 进入 D 盘,运行mv.bat
1
2
3
4
@echo off
robocopy "C:\\Users" "D:\\Users" /E /COPYALL /XJ /XD WindowsApps
rmdir "C:\\Users" /S /Q
mklink /J "C:\\Users" "D:\\Users"

Windows UI 和控制台字体设置

  • 右键为所有用户安装MSYHMONO.ttf字体
  • 运行font.regconsole.regcontextmenu.regconsole.bat

font.reg如下,用于设置某些软件 UI (如 Mendeley,Ansys 等)字体

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
Windows Registry Editor Version 5.00

;; 字体设置

[HKEY_CLASSES_ROOT\MIME\Database\Codepage\936]
"FixedWidthFont"="Microsoft YaHei Mono"
"ProportionalFont"="Microsoft YaHei Mono"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\MIME\Database\Codepage\936]
"FixedWidthFont"="Microsoft YaHei Mono"
"ProportionalFont"="Microsoft YaHei Mono"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\GRE_Initialize]
"GUIFont.Facename"="Microsoft YaHei UI"

[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion\GRE_Initialize]
"GUIFont.Facename"="Microsoft YaHei UI"

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\FontAssoc\Associated DefaultFonts]
"AssocSystemFont"="msyh.ttc"
"FontPackage"="微软雅黑"
"FontPackageDontCare"="微软雅黑"
"FontPackageRoman"="微软雅黑"
"FontPackageSwiss"="微软雅黑"
"FontPackageModern"="微软雅黑"
"FontPackageScript"="微软雅黑"
"FontPackageDecorative"="微软雅黑"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FontAssoc\Associated DefaultFonts]
"AssocSystemFont"="msyh.ttc"
"FontPackage"="微软雅黑"
"FontPackageDontCare"="微软雅黑"
"FontPackageRoman"="微软雅黑"
"FontPackageSwiss"="微软雅黑"
"FontPackageModern"="微软雅黑"
"FontPackageScript"="微软雅黑"
"FontPackageDecorative"="微软雅黑"

console.reg文件如下,用于设置cmd/powershell窗口字体与大小

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
Windows Registry Editor Version 5.00

;; 控制台设置

; 设置 命令提示符/PowerShell 窗口字体与大小
[HKEY_CURRENT_USER\Console]
"FaceName"="Microsoft YaHei Mono"
"FontSize"=dword:00120000; 18 号字体, 18十六进制为0012
"WindowSize"=dword:00190078; 120*25, 20十六进制为0019, 100十六进制为0078
"WindowAlpha"=dword:000000e6; 90% 透明

; 设置 PowerShell(x86) 窗口字体与大小
[HKEY_CURRENT_USER\Console\%SystemRoot%_System32_WindowsPowerShell_v1.0_powershell.exe]
"FaceName"="Microsoft YaHei Mono"
"FontSize"=dword:00120000; 18 号字体, 18十六进制为0012
"WindowSize"=dword:00190078; 25*120, 25十六进制为0019, 100十六进制为0078
"WindowAlpha"=dword:000000e6; 90% 透明


; 设置 PowerShell 窗口字体与大小
[HKEY_CURRENT_USER\Console\%SystemRoot%_SysWOW64_WindowsPowerShell_v1.0_powershell.exe]
"FaceName"="Microsoft YaHei Mono"
"FontSize"=dword:00120000; 18 号字体, 18十六进制为0012
"WindowSize"=dword:00190078; 25*120, 25十六进制为0019, 100十六进制为0078
"WindowAlpha"=dword:000000e6; 90% 透明

contextmenu.reg如下,设置右键cmd 此处打开命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Windows Registry Editor Version 5.00

;; 右键命令行窗口菜单

; 在此处打开命令窗口(&W)
[-HKEY_CLASSES_ROOT\Directory\Background\shell\cmd]
[HKEY_CLASSES_ROOT\Directory\Background\shell\cmd]
@="@shell32.dll,-8506"
"Extended"=""
"NoWorkingDirectory"=""
"Icon"="C:\\Windows\\System32\\cmd.exe, 0"

[HKEY_CLASSES_ROOT\Directory\Background\shell\cmd\command]
@="cmd.exe /s /k pushd \"%V\""

; 以管理员身份打开命令窗口(&A)
[HKEY_CLASSES_ROOT\Directory\Background\shell\runas]
"ShowBasedOnVelocityId"=dword:00639bc8
"Extended"=""
"Icon"="C:\\Windows\\System32\\cmd.exe ,0"
"MUIVerb"="以管理员身份打开命令窗口(&A)"

[HKEY_CLASSES_ROOT\Directory\Background\shell\runas\command]
@="cmd.exe /s /k pushd \"%V\""

console.bat如下。用于修复右键开始菜单打开命令窗口异常。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
@echo off
chcp 65001
echo 删除 PowerShell 快捷方式

del "%AppData%\Microsoft\Windows\Start Menu\Programs\Windows PowerShell\Windows Powershell.lnk"
del "%AppData%\Microsoft\Windows\Start Menu\Programs\Windows PowerShell\Windows Powershell (x86).lnk"

echo 创建 PowerShell 快捷方式

set PWS=powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile

set TARGET='%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe'
set SHORTCUT='%AppData%\Microsoft\Windows\Start Menu\Programs\Windows PowerShell\Windows Powershell.lnk'
%PWS% -Command "$ws = New-Object -ComObject WScript.Shell; $s = $ws.CreateShortcut(%SHORTCUT%); $S.TargetPath = %TARGET%; $S.Save()"

set TARGET='%SystemRoot%\syswow64\WindowsPowerShell\v1.0\powershell.exe'
set SHORTCUT='%AppData%\Microsoft\Windows\Start Menu\Programs\Windows PowerShell\Windows Powershell (x86).lnk'
%PWS% -Command "$ws = New-Object -ComObject WScript.Shell; $s = $ws.CreateShortcut(%SHORTCUT%); $S.TargetPath = %TARGET%; $S.Save()"

pause

Windows 相关优化