美国微软公司研发的一套图形化操作系统,目前在桌面操作系统市场上的占有率远超其他同类产品。

为什么 Windows 笔记本合盖放包里会持续发热

2026-09-03

很多人都有过这样的经历:下班合上笔记本塞进双肩包,半小时后回家一摸,机身烫手、风扇空转、电量从满电掉到 2%。这往往不是忘点睡眠,也不是钥匙压到开机键,而是 Windows 近几代强推的“现代待机”(Modern Standby,S0ix)在作祟。

旧版 Windows 用的是沿用了二十多年的 ACPI S3 睡眠:合盖即切断 CPU、显卡、风扇与大部分主板供电,只留微弱电流给内存,整机能耗常低于 0.5 瓦,放包里三天也是凉的。
微软为模仿 iPad、MacBook“合盖收邮件、掀盖秒唤醒”的体验,在 Win10 强推、Win11 全面普及 S0 现代待机——合盖后 CPU 不断电,WiFi、蓝牙、后台服务、系统更新继续跑,驱动和外设随时能把系统唤醒。

苹果能这么做,是因为芯片、硬件、系统全自研深度适配,而 Windows 面对的是杂乱第三方驱动(声卡、网卡、指纹、拓展坞、游戏反作弊等)。只要有一个驱动没进低功耗,或包里蓝牙鼠标晃一下连上,CPU 就被唤醒满负荷。
双肩包的海绵尼龙本就隔热,进出风口被堵死,十几瓦热量闷在密闭空间,半小时机身就能到七八十度,风扇只能循环热风,直到把电池榨干。
更离谱的是,先合盖再拔电源,系统会把“断电”当唤醒事件,盖子已合不再睡回去,于是满负载烤一路。

Win11 24H2 虽加了唤醒节流,但治标不治本。

微软先是在注册表删掉退回 S3 的开关,后来联合厂商在新机 BIOS 里直接剔除 S3 代码,硬件层锁死现代待机。用 powercfg /a 查,若显示“S0 低电量待机已启用、S3 固件不支持”,就是中招。还可以使用 powercfg /sleepstudy 看是谁唤醒的。

最稳妥的解法:控制面板→电源选项→“关闭盖子时”由“睡眠”改为“休眠(Hibernate)”。休眠把内存写进硬盘后彻底断电,包里不会再发热耗电,代价只是开机多等两三秒。长期带电脑通勤的人,合盖前确认进休眠或直接关机,比依赖“智能睡眠”实在得多。

总结自微信公众号 IT服务圈 的文章《为什么 Windows 笔记本合上盖子放进书包,经常会被烫成铁板烧?》。

WSL 检测到 localhost 代理配置

2025-09-04

Cygwin 实在是有点太慢了,忍不了,研究好几次也没有解决慢的问题,切入 WSL2 了。

但是留意到打开 WSL 总有这个警告:

wsl: 检测到 localhost 代理配置,但未镜像到 WSL。NAT 模式下的 WSL 不支持 localhost 代理。

按照 CSDN 上的文章,在用户目录下创建 .wslconfig:

[experimental]
autoMemoryReclaim=gradual
networkingMode=mirrored
dnsTunneling=true
firewall=true
autoProxy=true

PS: 按照文档下面 4 个已经不再是实验性了,应该放在 wsl2 Section 下。
PS:后面三个 true 配置是默认值,不需要。

配置之后,在 cmd 中执行 wsl --shutdown 重启一下,果然就不报了,但是 WSL 中无法使用公司的 VPN 连接内网。

根据文档,networkingMode 有四种取值:

  • none 关闭网络连接
  • nat NAT,默认值
  • mirrored
  • virtioproxy 使用 VirtioProxy 网络代理

发现只有 mirrored 配置才不打印警告信息,但是就是不能使用 VPN。

[wsl2]
networkingMode=mirrored

算了,还是忍忍吧。

pagefile.sys 是什么文件,为什么这么大?

2024-03-27

pagefile.sys 是 Windows 系统的虚拟内存分页文件,默认位于系统盘根目录,通常是 C 盘。它的作用是在物理内存(RAM)不足或需要释放内存时,将部分暂时不活跃的内存数据写入磁盘,为系统提供额外的内存管理空间。

这个文件为什么这么大?主要取决于系统内存容量、虚拟内存配置以及系统对内存转储的需求。Windows 通常会自动管理分页文件大小,因此可能占用数 GB 甚至几十 GB。

关机时,系统一般不会逐页清除其中的数据,而是保留文件,以便下次启动后继续使用,避免反复创建和调整文件带来的开销。需要注意的是,保留文件不等于永久保存里面的数据。分页文件中的内容会随着系统运行不断被覆盖和更新,其大小也不代表实际存储了多少有效数据。

另外,Windows 还可能利用分页文件保存系统崩溃转储数据,以便故障发生后进行分析。

如果磁盘空间紧张,可以在「系统属性 → 高级 → 性能设置 → 高级 → 虚拟内存」中调整配置,但不建议直接删除或彻底禁用。

简单来说,pagefile.sys 并不是垃圾文件,而是 Windows 内存管理机制的重要组成部分。除非明确了解其影响,否则建议保留系统自动管理。

Windows 操作习惯养成

2023-12-23

Windows 11

触摸板

  • 单指:点击,双击,双击拖动
  • 双指:滚动,点击(鼠标右键),捏合(缩放场景)
  • 三指:
  • 上、下:多任务视图/显示桌面
  • 左、右:切换应用
  • 点击:搜索
  • 四指:
  • 上、下:多任务视图/显示桌面(调整为:最大化窗口/最小化窗口)
  • 左、右:切换桌面
  • 点击:通知中心

快捷键

按键 作用
Win + ~ 下拉命令行窗口

TAB

按键 作用
Win + Tab 多任务视图
Alt + Tab 切换应用
Alt + Ctrl + Tab 应用切换(应用选择)

任务栏应用

按键 作用
Win + Num 启动任务栏应用/窗口切换
Win + Ctrl + Num 启动任务栏应用/窗口切换(有点不一样)
Win + Shift + Num 启动任务栏应用(新窗口)
Win + Shift + Alt + Num 启动任务栏应用(管理员权限)
Win + Alt + Num 任务栏应用菜单

WSL git 太慢

2023-10-15

使用 WSL 的时候 git 用得简直令人难受,每次切换环境(Windows 和 WSL),都需要 Refresh Index,一次就得二十几秒。

最后只好搞一个别名:

# 5.15.90.1-microsoft-standard-WSL2
if [[ "`uname -r`" == *WSL2 ]]; then
    SHMODE=wsl
fi

if [[ $SHMODE == "wsl" ]]; then
    alias git=git.exe
fi

这是我的本地环境中截出来得一点,其实还做了一些其他得适配,总算能够接受了。

原因

暂时没有读到相关资料。
WSL 已经出来很久了,可是这些性能问题微软还是没有解决,可能是他们不想解决。

参考资料与拓展阅读

Windows 10 开发环境重装笔记

2023-07-03

基础环境:Windows 10 (带 Edge)

  1. 驱动更新

  2. 激活

  3. Windows 更新
    PS:系统更新之后就会有 winget 了

  4. 用户目录下的文件夹链接到移动磁盘
    视频,图片,文档,下载,音乐

  5. 360 “优化” 一番

  6. 360安全卫士

  7. 驱动大师
  8. 360压缩

  9. 复制目录 .ssh, .config 目录

  10. 配置网络代理 + 办公网络 VPN

  11. 安装软件

winget 在 msstore 中叫做“应用安装程序”
Windows Terminal 也可以在 msstore 中找到

winget install Microsoft.VisualStudioCode
winget install Microsoft.Edge
winget install Microsoft.WindowsTerminal

winget install Git.Git
winget install qishibo.AnotherRedisDesktopManager # 导入配置即可
winget install ScooterSoftware.BeyondCompare4
winget install KeePassXCTeam.KeePassXC
winget install Apifox.Apifox

# winget install Tencent.wechat-work
winget install Tencent.WeCom
winget install Tencent.WeChat

winget install Python.Python.3.8
winget install GoLang.Go

winget install voidtools.Everything
winget install hluk.CopyQ

winget install Nutstore.Nutstore
winget install NetEase.YoudaoNote # 有道云笔记
winget install NetEase.CloudMusic # 有道云音乐

# winget install iFlytek.iFlyIME # 讯飞输入法
winget install Rime.Weasel # 小狼毫输入法(Rime)

# 无需安装,走笔记本中转
# winget install OpenVPNTechnologies.OpenVPNConnect

其他软件:

  • Filezilla Client

无需安装:

  • GFW,走笔记本中转
  • HeidiSQL(Portable 版本)

Edge 浏览器

  1. 自动更新:... > 帮助与反馈 > 关于 Microsoft Edge
  2. 登录账号,自动同步
  3. 同步需要一段时间,可以先安装上 SwitchyOmega:
    https://microsoftedge.microsoft.com/addons/search/switchyomega?hl=zh-CN

VSCode

  1. 登录账号,自动同步
  2. 同步需要一段时间,可以先安装上 Remote - SSH

Windows Terminal

  1. 配置上开发机器的 SSH 连接,作为默认会话
  2. 记住 GitBash 的快捷键

访问开发机器 zsh 的时候,Home / End 失灵,只能 Ctrl + A / Ctrl + E 代替。

  1. bash 没有问题
  2. Putty 连接 zsh 也是好的

经过一番实验,发现使用 Git 带的 ssh 就好了:

# C:\Windows\System32\OpenSSH\ssh.exe
C:\Users\Administrator>ssh -V
OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5

# C:\Program Files\Git\usr\bin\ssh.exe
C:\Users\Administrator>"C:\Program Files\Git\usr\bin\ssh.exe" -V
OpenSSH_9.0p1, OpenSSL 1.1.1p  21 Jun 2022

# 作为对照,这是开发机器 (Ubuntu 22.10) 上的 SSH 版本:
ssh -V
OpenSSH_8.9p1 Ubuntu-3ubuntu0.1, OpenSSL 3.0.2 15 Mar 2022
"C:\Program Files\Git\usr\bin\ssh.exe" markjour@172.16.0.49 -F C:\Users\Administrator\.ssh\configwin

Git Bash

~/.bash_profile

test -f ~/.profile && . ~/.profile
test -f ~/.bashrc && . ~/.bashrc

~/.bashrc

source ~/Projects/StdEnv/aliases/main.sh

旧磁盘格式化 + 反复覆写

dd if=/dev/zero of=/e/bigfile bs=10M

winget 安装 MariaDB

2022-08-17

部署

# 安装 <https://winget.run/pkg/MariaDB/Server>
winget install mariadb.server

# 这一步应该是安装程序自动执行了
# 但是没有自动安装服务,也没有为 root 配置密码
# 有很多参数,可以参考 `mysql_install_db --help`
# mysql_install_db

# 安装服务
& 'C:\Program Files\MariaDB 10.8\bin\mysqld.exe' --install-manual MariaDB
# 根据资料,可以指定配置文件,但是我没有这么操作过,都是用的默认值:
# --defaults-file=D:\DB02\my.ini
# 如果启动另一个服务进程,记得在配置文件中指定新的 datadir

# 启动服务
# services.msc 中手动启动服务,或者,
# 管理员权限启动命令行,然后执行:
net start MariaDB
sc start MariaDB

# 停止服务
net stop MariaDB
sc stop MariaDB

# 删除服务
sc delete MariaDB
C:\>dir "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\MariaDB 10.8 (x64)"
 驱动器 C 中的卷是 Windows
 卷的序列号是 56D1-41EB

 C:\ProgramData\Microsoft\Windows\Start Menu\Programs\MariaDB 10.8 (x64) 的目录

2022/08/15  21:33    <DIR>          .
2022/08/15  21:33    <DIR>          ..
2022/08/15  21:33             1,154 Command Prompt (MariaDB 10.8 (x64)).lnk
2022/08/15  21:33               909 Database directory (MariaDB 10.8 (x64)).lnk
2022/08/15  21:33             1,000 Error log (MariaDB 10.8 (x64)).lnk
2022/08/15  21:33               944 HeidiSQL.lnk
2022/08/15  21:33             1,000 my.ini (MariaDB 10.8 (x64)).lnk
2022/08/15  21:33             1,208 MySQL Client (MariaDB 10.8 (x64)).lnk
               6 个文件          6,215 字节
               2 个目录 309,073,027,072 可用字节

默认的 MariaDB 安装在 C:\Program Files\MariaDB 10.8,数据在 data 子目录,配置文件 my.ini 就在 data 子目录。
PS:震惊,我才发现 MariaDB 自带了一个 heidisql!!!

设置密码

这个时候可以直接通过 root 登录上去,不需要密码。
搜索 mysql.user 可以发现:

MariaDB [(none)]> select host, user, password, plugin, authentication_string from mysql.user;
+-----------+-------------+----------+-----------------------+-----------------------+
| Host      | User        | Password | plugin                | authentication_string |
+-----------+-------------+----------+-----------------------+-----------------------+
| localhost | mariadb.sys |          | mysql_native_password |                       |
| localhost | root        |          |                       |                       |
| victus    | root        |          |                       |                       |
| 127.0.0.1 | root        |          |                       |                       |
| ::1       | root        |          |                       |                       |
+-----------+-------------+----------+-----------------------+-----------------------+
5 rows in set (0.001 sec)
mariadb-admin status -uroot
mysql -uroot

# 设置密码
# 如果忘记密码登录不进去了,怎么重置,这是另一个话题了
& 'C:\Program Files\MariaDB 10.8\bin\mysqladmin.exe' -uroot password 123456

默认配置

SHOW VARIABLES LIKE "%char%";
Variable_name Value
character_set_client utf8mb4
character_set_connection utf8mb4
character_set_database latin1
character_set_filesystem binary
character_set_results utf8mb4
character_set_server latin1
character_set_system utf8mb3
character_sets_dir C:\Program Files\MariaDB 10.8\share\charsets\
SHOW VARIABLES LIKE "%system%";
SHOW VARIABLES LIKE "%log%";
SHOW VARIABLES LIKE "%version%";
SHOW VARIABLES LIKE "%dir%";

SHOW CHARACTER SET;
SHOW COLLATION;

Win11 右键菜单

2022-08-13

Windows 11 右键菜单样式调整了,像是变成两级了,我经常需要点击 “显示更多选项”(Show more options),感觉很麻烦,今天在网上找到了解决办法:

# enable
reg add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve​

# disable
reg delete "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}" /f​

# restart explorer
taskkill /f /im explorer.exe
start explorer.exe

winget: Windows 包管理工具

2022-06-04
winget list
winget list -?
winget search xxx     # 搜索
winget install xxx    # 安装
winget upgrade        # 列出 upgradable 包
winget upgrade xxx    # 升级指定包
winget upgrade --all  # 升级
winget
Windows 程序包管理器 v1.3.2691
版权所有 (C) Microsoft Corporation。保留所有权利。

WinGet 命令行实用工具可从命令行安装应用程序和其他程序包。

使用情况: winget [<命令>] [<选项>]

下列命令有效:
  install    安装给定的程序包
  show       显示包的相关信息
  source     管理程序包的来源
  search     查找并显示程序包的基本信息
  list       显示已安装的程序包
  upgrade    显示并执行可用升级
  uninstall  卸载给定的程序包
  hash       哈希安装程序的帮助程序
  validate   验证清单文件
  settings   打开设置或设置管理员设置
  features   显示实验性功能的状态
  export     导出已安装程序包的列表
  import     安装文件中的所有程序包

如需特定命令的更多详细信息,请向其传递帮助参数。 [-?]

下列选项可用:
  -v,--version  显示工具的版本
  --info        显示工具的常规信息

可在此找到更多帮助: https://aka.ms/winget-command-help

ReactOS: 开源版的 Windows

2022-04-29

我对开发者十分佩服,几十年如一日的开发这样一个现阶段明显没有盈利可能的系统。等这个项目稳定下来之后,或许很多古老的遗留系统可以收益。

相关的镜像可以在 SourceForge 上取得, 最新的版本是 03/31 发布的 0.4.14 release 19,可以下载 LiveCD 体验。
PS:完整的 ISO 只有 110M,Live 版 80M。
PS:最新版完整镜像的下载链接: https://sourceforge.net/projects/reactos/files/latest/download

项目介绍

1995 年,FreeWin95 项目
1998 年,ReactOS 项目启动

主要用 C 编写。目标是完全不采用 Windows 代码的前提下,对 x86/amd64 平台的 Windows NT 5.2 (Windows Server 2003) 兼容。
代码审核非常严格,曾经由于被怀疑用了反编译 Windows 的代码而自行开展大规模的代码审查。
研发团队规模有限。

GitHub 地址: https://github.com/reactos/reactos
stars watchers forks
license commit freq

推荐的硬件配置:

  1. CPU: x86/amd64 兼容处理器
  2. 内存:256MB (最小 64MB)
  3. 硬盘:IDE/SATA,主分区至少 350MB
  4. 显卡:2MB VGA
  5. CD-ROM,普通键鼠

体验感受

VirtualBox 4C1G 虚拟机,起最新版 Live 镜像,大概 2 分钟后进入桌面(Installing devices 这一步太久了)。
选的 Chinese (RPC) 语言,然后 US 键盘。Run ReactOS Live CD 进来之后,中文都是小方框。
然后重启,选择安装 (Install ReactOS),提示需要插入安装媒体。
然后还是换成 English (United States) 语言, 可以进入桌面,但是感觉不怎么流畅。

参考资料与拓展阅读

Windows 10 在磁贴中新建快捷方式

2021-06-27

一般安装的软件都可以在开始菜单的 “所有应用” 中看到,选 “固定到开始屏幕” 就行了。

不过,那些 Portable 的绿色软件,如果要放进去怎么弄呢?

  1. 创建快捷方式(我一般直接发送快捷方式到桌面)
  2. 将快捷方式复制到 C:\ProgramData\Microsoft\Windows\Start Menu\Programs\
    我一般会改个名,比如:qq.exe => QQ
  3. 现在会发现 所有应用 里面出现了新增的那个快捷方式
  4. 然后,就是固定到开始屏幕就行了。

Windows 命令行操作

2021-03-07

cmd

  • 大小写不敏感
  • 参数通常是 / 开头,而不像 Unix 下是 -
  • 帮助: -help, /?
  • | 管道、> 输出重定向、>> 输出重定向(追加)、< 输入重定向、<< EOF heredoc、<<< CONTENT 输入重定向(字符串)作用和 Linux 相同
  • Ctrl + C 退出执行
help
help | more
dir C:\Windows\System32\*.exe
dir C:\Windows\System32\*.msc

export
echo
cls         # 类似 clear

tasklist
taskkill

cd
mkdir / md
del         # 类似 rm
del /q anydir
rd          # 删除目录(非空目录不可删除)
dir         # 类似 ls
tree
find
findstr     # 类似 grep

ping
ipconfig
netstat
tracert
route
dig
nslookup

shutdown -s -t 300 # 定时关机

explorer # 文件浏览器
notepad  # 记事本
taskmgr  # 命令管理器
regedit  # 注册表编辑器

services.msc # 服务

注册表

Registry, 港澳台地区称之为登录档。就是一个树形结构的数据库,存放系统和应用程序的配置信息。

Linux 下各个应用程序,甚至操作系统的各组件都采用不同的配置文件存储在不同的地方,但 Windows 却采用了这种集中式存储。

https://zh.wikipedia.org/zh-hans/注册表

名称 作用
HKEY_CLASSES_ROOT 存储Windows可识别的文件类型的详细列表,以及相关联的程序。
HKEY_CURRENT_USER 存储当前用户设置的信息。
HKEY_LOCAL_MACHINE 包括安装在计算机上的硬件和软件的信息。
HKEY_USERS 包含使用计算机的用户的信息。
HKEY_CURRENT_CONFIG 这个分支包含计算机当前的硬件配置信息。

常见数据结构:

  • REG_SZ 字符串
  • REG_BINARY 二进制
  • REG_DWORD 32 位二进制值,显示为 8 位的十六进制数
  • REG_MULTI_SZ 多字符串,nul 隔开,结尾两个 nul
  • REG_EXPAND_SZ

python 有内置库 winreg 可以用来操作注册表。

import winreg
reg = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE)
key_name = r'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall'
key = winreg.OpenKey(reg, key_name)
for i in range(1024):
    try:
        sub_key_name = winreg.EnumKey(key, i)
        sub_key = winreg.OpenKey(key, sub_key_name)
        value = winreg.QueryValueEx(sub_key, "DisplayName")
        print('%s: %s' % (sub_key_name, value))
    except EnvironmentError:
        break

Services

# 小心 sc 命令中比较另类的等于号后有空格设计
sc create memcached binPath= "c:\memcached.exe -l 0.0.0.0 -m 128 -d" DisplayName= "Memcached" start= auto

PowerShell

虽然使用频率不高,但和 PowerShell 少有的几次接触感觉很好,很强大。其结构化而非文本的数据结构让人印象深刻。

  • 别名
  • 函数
  • cmdlet
  • 命令
get-alias | findstr /I get-alias
gal | findstr ls

man
help
ls   # Get-ChildItem
ps   # Get-Process
ps | select Name, Id
ps | ft -Property Id, ProcessName, Handles, VM, WS, CPU -AutoSize
ps | where { $_.Name -eq "explorer" }
curl # Invoke-WebRequest
rm      # Remove-Item
rmdir   # Remove-Item
ni -ItemType File -Path C:\Users\Administrator\file.txt  # New-Item
cp      # Copy-Item
cp -Path C:\Users\Administrator\file.txt -Destination D:\Temp\

gcm  # Get-Command
shcm # Show-Command

get-volume

工具

GUI

  • process explorer
  • everything
  • HeidiSQL
  • PuTTY
  • WizTree 目录分析

包管理

  • choco (chocolatey)
  • scoop
  • winget

安装包格式

  • MSI 官方出品, Windows Installer
  • NSIS Nullsoft Scriptable Install System, zlib license
  • WiX
  • Inno Setup

修改 cmd 字体

2021-02-14

Windows CMD 太挫,中文字体选择少,XP, Win7 下只有点阵字体 (fixedsys) 和新宋体,Win10 字体又多了几个,但效果页不太好。
不过 Win10 的话,可能是半年前吧,微软新出来了一个 Windows Terminal 的虚拟终端,就现代化多了。现在我在 Windows 下(偶尔)一般都是用的新版 Terminal + PowerShell,听方便。
但如果由于 OS 版本等问题,离不开 cmd 的话,有两个方法,一个是使用第三方终端模拟器,比如 cmder;再一个就是想办法定制一下 cmd 的字体。
我在这里记录一下之前使用的一个方案失效地址(确认有效,不过好久都没有用了)。

Windows 特殊文件

2020-05-27
  • 虚拟内存相关
  • pagefile.sys:Windows 的交换(SWAP)文件。默认在 C 盘根目录,和内存一样大,可以在“高级系统设置”中更改其位置和大小。
  • hiberfil.sys:休眠模式系统状态转储文件。一般也会有几个 G。
  • swapfile.sys:Win10 引入,作用和 pagefile.sys 相同,但他的大小可以自动调整。
  • desktop.ini:文件夹配置文件(隐藏文件),用于自定义文件夹的外观和行为。
  • thumbs.db:缩略图缓存文件(隐藏文件),用于加快文件夹中图像文件的显示速度。
  • ntuser.dat:用户配置文件(隐藏文件),包含了用户的注册表设置和个人偏好。
  • boot.ini:启动配置文件,用于指定启动选项和操作系统位置。

Git 链接文件

2020-03-22

Git 在团队协作的情况下容易遇到很多小问题,有一类是由于跨平台的系统差异导致的。有人习惯 Windows 下开发,有人习惯 Linux 下开发。

最常见的是这么四个问题:

  1. 文件权限问题
  2. 基本上我还没有遇到有需要给仓库中的文件设置权限的情况,但是由于权限的变更导致提交进来没有内容更改的文件就完全没有必要
  3. 所以非常必要设置 core.filemode false
  4. chmod 644 *.md
  5. 换行符问题
  6. Windows 新建的文件都是 \r\n 换行,Linux 则是 \n
  7. core.autocrlf true 可以在 checkout 的时候根据系统自动转换换行符
  8. 但是我觉得这个可能放到 hook 里面,在提交检查的时候一起做更加合适
  9. dos2unix *.md
  10. 软链接问题

  11. Linux 下的软链接切到 Windows 下之后,变成了一个普通文本,内容是链接的路径

  12. core.symlinks true 可以解决这个问题,这也是默认值,可是有些时候我们的环境中配置的就是 false
  13. 我的 Git for Windows 不知道为什么,system 配置就是设置成 false 了
  14. 有些情况下,项目配置似乎就默认是 false
  15. 如果已经成为现实了,软链是个文本,我们改配置,重新添加,然后 pull 到本地可以

core.symlinks
If false, symbolic links are checked out as small plain files that contain the link text. git-update-index and git-add will not change the recorded type to regular file. Useful on filesystems like FAT that do not support symbolic links.
The default is true, except git-clone or git-init will probe and set core.symlinks false if appropriate when the repository is created.

  1. 文件名大小写问题
  2. Linux 大小写敏感,比如 Apple.txt 和 apple.txt 可以在同一个目录,Windows 环境克隆下来,只能看到一个文件 apple.txt
  3. 没什么好的办法,应该也是在提交的时候作为风格检查
$ git config --list --global | grep sym
$ git config --list --system | grep sym
core.symlinks=false
$ git config --list --local | grep sym
core.symlinks=false

关于链接的另一个办法

CSDN 博客上看到 《windows上使用git仓库的问题(换行符、文件权限、软链接)》,里面提出下面这个思路。
虽然代码不够严谨,但是思路应该是没有问题的。以后遇到问题可以参考(还没有验证):

  1. 找出链接文件
  2. 创建 Windows 链接
  3. 操作索引区,忽略这个变更
import os

def rindex(lst, value):
    try:
        return lst.rindex(value)
    except ValueError:
        return -1

# find symbol link files or dirs
fp = os.popen("git ls-files -s | awk '/120000/{print $4}'")
links = fp.read().strip().split("\n")

# get symbol links' parent dir
link_dir = set()
for link in links:
    index = rindex(link, "/")
    if (index != -1):
        link_dir.add(link[:index])
    else:
        link_dir.add(".")

work_dir = os.getcwd()
# make link for every symbol link
for d in link_dir:
    os.chdir("/".join([work_dir,d]))
    fp = os.popen("ls -la")
    items = fp.read().strip().split("\n")
    for item in items:
        if "->" in item:
            tks = item.split("->")
            src = tks[0].strip().split(" ")[-1]
            dst = tks[1].strip().split("/")
            if (len(dst) > 1):
                dst = "\\\\".join(dst)
            else:
                dst = dst[0]
            print ("link " + src + " -> " + dst)
            os.popen("rm " + src)
            if (os.path.isfile(dst)):
                os.popen("cmd /c mklink /H " + src + " " + dst)
            else:
                os.popen("cmd /c mklink /j " + src + " " + dst)
            # make links unchanged
            os.popen("git update-index --assume-unchanged " + "/".join([os.getcwd(), src]))

参考资料与拓展阅读

Windows 10 镜像下载

2020-03-19

https://msdn.itellyou.cn/

Windows 10 Enterprise LTSC 2019

# x64
Windows 10 Enterprise LTSC 2019 (x64) - DVD (Chinese-Simplified)
文件名:cn_windows_10_enterprise_ltsc_2019_x64_dvd_9c09ff24.iso
SHA1:24b59706d5eded392423936c82ba5a83596b50cc
文件大小:4.17GB
发布时间:2019-03-15
ed2k://|file|cn_windows_10_enterprise_ltsc_2019_x64_dvd_9c09ff24.iso|4478906368|E7C526499308841A4A6D116C857DB669|/

# x86 (32 位)
Windows 10 Enterprise LTSC 2019 (x86) - DVD (Chinese-Simplified)
文件名:cn_windows_10_enterprise_ltsc_2019_x86_dvd_1814dbab.iso
SHA1:ba2169edd94f123211cd4aaca68352f1ab6195d9
文件大小:2.98GB
发布时间:2019-03-15
ed2k://|file|cn_windows_10_enterprise_ltsc_2019_x86_dvd_1814dbab.iso|3196803072|2D39C54A2E99BAC308191C74A15B3237|/
Windows 10 Enterprise LTSC 2021 (x64) - DVD (Chinese-Simplified)
文件:SW_DVD9_WIN_ENT_LTSC_2021_64BIT_ChnSimp_MLF_X22-84402.ISO
大小:4.7GB
MD5:2579B3865C0591EAD3A2B45AF3CABEEE
SHA1:C19D7DAFBAFEB26C36E31D97C465E87C7A6E8A4C
SHA256:C117C5DDBC51F315C739F9321D4907FA50090BA7B48E7E9A2D173D49EF2F73A3
ed2k://|file|SW_DVD9_WIN_ENT_LTSC_2021_64BIT_ChnSimp_MLF_X22-84402.ISO|5044211712|1555B7DCA052B5958EE68DB58A42408D|/

Windows 11

ed2k://|file|zh-cn_windows_11_business_editions_version_22h2_updated_nov_2022_x64_dvd_3623b3e1.iso|5567041536|B83E64D03E93B418840E5B270E164005|/

Windows 开机启动

2018-01-26

我想开机启动 TIM,但是 TIM 的设置没有用,重启之后这个选项又自己取消了,只好另外寻找方法。
发现这个方法就挺好用,只需把应用程序的快捷方式复制到一个目录。

这三个方法都可以用资源管理器打开这个目录:

  1. win + r 然后 shell:startup 回车
  2. explorer %appdata%\Microsoft\Windows\Start Menu\Programs\Startup
  3. explorer %userprofile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

Windows 命令大全

2018-01-15

Active Directory

  • ADmodcmd Active Directory Bulk Modify
  • CSVDE Import or Export Active Directory data
  • DSACLs Active Directory ACLs
  • DSAdd Add items to active directory (user group computer)
  • DSGet View items in active directory (user group computer)
  • DSQuery Search for items in active directory (user group computer)
  • DSMod Modify items in active directory (user group computer)
  • DSMove Move an Active directory Object
  • DSRM Remove items from Active Directory

Batch Files

  • CALL Call one batch program from another 内部命令
  • CHOICE Accept keyboard input to a batch file
  • CLIP Copy STDIN to the Windows clipboard
  • CLS Clear the screen 内部命令
  • CMD Start a new CMD shell
  • COLOR Change colors of the CMD window 内部命令
  • DOSKEY Edit command line, recall commands, and create macros
  • ECHO Display message on screen 内部命令
  • ENDLOCAL End localisation of environment changes in a batch file 内部命令
  • EVENTCREATE Add a message to the Windows event log
  • EXIT Quit the current script/routine and set an errorlevel 内部命令
  • FOR /F Loop command: against a set of files 内部命令
  • FOR /F Loop command: against the results of another command 内部命令
  • FOR Loop command: all options Files, Directory, List 内部命令
  • GOTO Direct a batch program to jump to a labelled line 内部命令
  • IF Conditionally perform a command 内部命令
  • IFMEMBER Is the current user a member of a Workgroup
  • LOGTIME Log the date and time in a file
  • MAPISEND Send email from the command line
  • MORE Display output, one screen at a time
  • PAUSE Suspend processing of a batch file and display a message 内部命令
  • PROMPT Change the command prompt 内部命令
  • REM Record comments (remarks) in a batch file 内部命令
  • RUN Start | RUN commands
  • RUNAS Execute a program under a different user account
  • SET Display, set, or remove session environment variables 内部命令
  • SETLOCAL Control the visibility of environment variables 内部命令
  • SETX Set environment variables
  • SORT Sort input
  • SHIFT Shift the position of batch file parameters 内部命令
  • SLEEP Wait for x seconds
  • START Start a program, command or batch file 内部命令
  • TIMEOUT Delay processing of a batch file
  • TITLE Set the window title for a CMD.EXE session 内部命令
  • WAITFOR Wait for or send a signal
  • WMIC WMI Commands
  • :: Comment / Remark 内部命令

Disk Management

  • BCDBOOT Create or repair a system partition
  • BCDEDIT Manage Boot Configuration Data
  • CONVERT Convert a FAT drive to NTFS
  • CHKDSK Check Disk - check and repair disk problems
  • CHKNTFS Check the NTFS file system
  • DEFRAG Defragment hard drive
  • DISKPART Disk Administration
  • DISKSHADOW Volume Shadow Copy Service
  • DriverQuery Display installed device drivers
  • FORMAT Format a disk
  • FREEDISK Check free disk space (in bytes)
  • LABEL Edit a disk label
  • MOUNTVOL Manage a volume mount point
  • NTBACKUP Backup folders to tape
  • SFC System File Checker
  • VOL Display a disk label 内部命令

Files and Folders

  • ASSOC Change file extension associations 内部命令
  • ASSOCIAT One step file association
  • ATTRIB Change file attributes
  • BITSADMIN Background Intelligent Transfer Service
  • CACLS Change file permissions
  • CD Change Directory - move to a specific Folder 内部命令
  • CIPHER Encrypt or Decrypt files/folders
  • COMP Compare the contents of two files or sets of files
  • COMPACT Compress files or folders on an NTFS partition
  • COMPRESS Compress individual files on an NTFS partition
  • COPY Copy one or more files to another location 内部命令
  • CSCcmd Client-side caching (Offline Files)
  • DEL Delete one or more files 内部命令
  • DELTREE Delete a folder and all subfolders
  • DIR Display a list of files and folders 内部命令
  • ERASE Delete one or more files 内部命令
  • EXPAND Uncompress files
  • EXTRACT Uncompress CAB files
  • FC Compare two files
  • FIND Search for a text string in a file
  • FINDSTR Search for strings in files
  • FORFILES Batch process multiple files
  • FSUTIL File and Volume utilities
  • FTP File Transfer Protocol
  • FTYPE File extension file type associations 内部命令
  • iCACLS Change file and folder permissions
  • MD Create new folders 内部命令
  • MOVE Move files from one folder to another 内部命令
  • MKLINK Create a symbolic link (linkd)
  • OPENFILES Query or display open files
  • POPD Return to a previous directory saved by PUSHD 内部命令
  • PsFile Show files opened remotely
  • PUSHD Save and then change the current directory 内部命令
  • RECOVER Recover a damaged file from a defective disk
  • REN Rename a file or files 内部命令
  • REPLACE Replace or update one file with another
  • RD Delete folder(s) 内部命令
  • RMTSHARE Share a folder or a printer
  • ROBOCOPY Robust File and Folder Copy
  • SHARE List or edit a file share or print share
  • SHORTCUT Create a windows shortcut (.LNK file)
  • SUBINACL Edit file and folder Permissions, Ownership and Domain
  • TAKEOWN Take ownership of a file
  • TOUCH Change file timestamps
  • TREE Graphical display of folder structure
  • TYPE Display the contents of a text file 内部命令
  • WHERE Locate and display files in a directory tree
  • WINDIFF Compare the contents of two files or sets of files
  • XCACLS Change file and folder permissions
  • XCOPY Copy files and folders

Group Policy/Windows Installer

  • DevCon Device Manager Command Line Utility
  • GPRESULT Display Resultant Set of Policy information
  • GPUPDATE Update Group Policy settings
  • MSIEXEC Microsoft Windows Installer
  • PsInfo List information about a system
  • PsShutdown Shutdown or reboot a computer
  • REGSVR32 Register or unregister a DLL
  • SHUTDOWN Shutdown the computer
  • SLMGR Software Licensing Management (Vista/2008)
  • WUAUCLT Windows Update

Networking

  • ARP Address Resolution Protocol
  • BROWSTAT Get domain, browser and PDC info
  • DNSSTAT DNS Statistics
  • GETMAC Display the Media Access Control (MAC) address
  • IPCONFIG Configure IP
  • NET Manage network resources
  • NETDOM Domain Manager
  • NETSH Configure Network Interfaces, Windows Firewall & Remote access
  • NBTSTAT Display networking statistics (NetBIOS over TCP/IP)
  • NETSTAT Display networking statistics (TCP/IP)
  • NMBIND Manage Hyper-V network bindings
  • NSLOOKUP Name server lookup
  • PATHPING Trace route plus network latency and packet loss
  • PsPing Measure network performance
  • PING Test a network connection
  • ROUTE Manipulate network routing tables
  • TRACERT Trace route to a remote host

Processes

  • PATH Display or set a search path for executable files 内部命令
  • PsExec Execute process remotely
  • PsKill Kill processes by name or process ID
  • PsList List detailed information about processes
  • PsGetSid Display the SID of a computer or a user
  • PsSuspend Suspend processes
  • SCHTASKS Schedule a command to run at a specific time
  • SYSMON Monitor and log system activity to the Windows event log
  • TASKLIST List running applications and services
  • TASKKILL End a running process
  • TSKILL End a running process
  • TLIST Task list with full path

Printing

  • MODE Configure a system device
  • PRINT Print a text file
  • PRINTBRM Print queue Backup/Recovery
  • RUNDLL32 Run a DLL command (add/remove print connections)

Recovery

  • BOOTREC Repair or replace a partition boot sector (WinRE).
  • BCDBOOT Create or repair a system partition.
  • BCDEDIT Manage Boot Configuration Data.
  • WPEUTIL Run commands during a Windows Preinstallation Environment (WinPE) session.

Registry

  • REG Registry: Read, Set, Export, Delete keys and values
  • REGEDIT Import or export registry settings
  • REGINI Change Registry Permissions

Remote Desktop

  • CHANGE Change Terminal Server Session properties
  • Query Process Display processes (TS/Remote Desktop)
  • Query Session Display all sessions (TS/Remote Desktop)
  • Query TermServer List all servers (TS/Remote Desktop)
  • Query User Display user sessions (TS/Remote Desktop)
  • MSTSC Terminal Server Connection (Remote Desktop Protocol)
  • RASDIAL Manage RAS connections
  • RASPHONE Manage RAS connections
  • Reset Session Delete a Remote Desktop Session
  • TSDISCON Disconnect a Remote Desktop Session
  • WINRM Windows Remote Management
  • WINRS Windows Remote Shell

Services

  • CASPOL Code Access Security Policy Tool.
  • PORTQRY Display the status of ports and services
  • PsService View and control services
  • SC Service Control

System Information

  • CHANGEPK Upgrade device Edition/Product Key
  • DATE Display or set the date 内部命令
  • HELP Online Help
  • LOGMAN Manage Performance Monitor logs
  • MBSAcli Baseline Security Analyzer
  • MSINFO32 System Information
  • NOW Display the current Date and Time
  • NTRIGHTS Edit user account rights
  • PsLogList Event log records
  • SFC System File Checker
  • SXSTRACE Diagnose side-by-side problems.
  • SYSMON Monitor and log system activity to the Windows event log
  • SYSTEMINFO List system configuration
  • TIME Display or set the system time 内部命令
  • TypePerf Write performance data to a log file
  • VER Display version information 内部命令
  • VERIFY Verify that files have been saved 内部命令
  • WHOAMI Output the current UserName and domain

User Administration

  • ADDUSERS Add or list users to/from a CSV file
  • CERTREQ Request certificate from a certification authority
  • CleanMgr Automated cleanup of Temp files, recycle bin
  • CON2PRT Connect or disconnect a Printer
  • CMDKEY Manage stored usernames/passwords
  • DELPROF Delete user profiles
  • DIRUSE Display disk usage
  • LOGOFF Log a user off
  • MOVEUSER Move a user from one domain to another
  • MSG Send a message
  • PERMS Show permissions for a user
  • POWERCFG Configure power settings
  • PsLoggedOn Who's logged on (locally or via resource sharing)
  • PsPasswd Change account password
  • SUBST Associate a path with a drive letter

Commands marked • are Internal commands only available within the CMD shell.
All other commands (not marked with •) are external commands.
External commands may be used under the CMD shell, PowerShell, or directly from START-RUN.

参考资料与拓展阅读