程序员的 Windows 参考手册

Windows Manual For Programmers

Chocolatey

The Package Manager for Windows

Official Site: https://chocolatey.org/install

# Administrator Powershell Run
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

# check install
choco

Proxy

Install

choco install clash-for-windows

Config

Buy air plane

Git

Download Link : https://git-scm.com/download

Install

Run Installer.

Config

# check version
git --version

# commit info
git config --global user.email "myemail@example.com"
git config --global user.name "My Name"

# custom git log info
# https://www.liaoxuefeng.com/wiki/896043488029600/898732837407424
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"

Usage

Git command list (Chinese): https://www.ruanyifeng.com/blog/2015/12/git-cheat-sheet.html

# repo
git init
git clone <remote link>

# show info
git status
git log

##### commit #####
git add .
git add *
git commit -am "commit message"
git pull
git push

##### branch #####
# list all local and remote branchs
git branch -a
# list remote branch links
git remote -v
# switch to <brach-name>
git checkout <brach-name>
# create and switch to <branch-name>
git checkout -b <branch-name>
# delete <branch-name>
git branch -d <branch-name>
# delete remote <branch-name>
git push origin --delete <branch-name>

##### tag #####
# list tags
git tag
# add <tag-name> for current commit
git tag <tag-name>
# push <tag> to <remote>
git push <remote> <tag>
# push all tags
git push <remote> --tags

Github CLI

  • Download Installer: https://cli.github.com/

  • Login

gh auth login
  • Generate token at: https://github.com/settings/tokens

Markdown

Typora

Official Site: https://typora.io

  • Purchase: $14.99, ¥89
  • Preferences
  • Add Themes
  • Typora plugin: Typora plugins and feature enhancement tools.

Mark Text

Github:https://github.com/marktext/marktext

  • Open Source And Free

Oh My Posh

Official Site: https://ohmyposh.dev/

Install

# may not work
winget install JanDeDobbeleer.OhMyPosh -s winget
# quickly
Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://ohmyposh.dev/install.ps1'))

Config

# Document: https://ohmyposh.dev/docs/installation/prompt
# create $PROFILE file if not exist
New-Item -Path $PROFILE -Type File -Force

# Solve PowerShell blocks running local scripts
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine

# edit $PROFILE
notepad $PROFILE

add config by using the ys theme

# in $PROFILE
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/ys.omp.json" | Invoke-Expression

Font

Install Nerd Fonts (Support icons for some themes). Download fonts at: https://www.nerdfonts.com/font-downloads, For Example JetBrainsMono Nerd Font.

Config terminal font. This can be easily done by modifying the Windows Terminal settings (default shortcut: CTRL + SHIFT + ,). In your settings.json file, add the font.face attribute under the defaults attribute in profiles:

{
    "profiles": {
        "defaults": {
            "font": {
                "face": "JetBrainsMono Nerd Font"
            }
        }
    }
}

Useful tools

PSReadLine: zsh-autosuggestion alternative for powershell

Github: https://github.com/PowerShell/PSReadLine

Install from PowerShellGallery

# get posh version
Get-Host

# install the latest PowerShellGet
Install-Module -Name PowerShellGet -Force

# After installing PowerShellGet, you can get the latest prerelease version of PSReadLine by running
Install-Module PSReadLine -AllowPrerelease -Force

Add Config: notepad $PROFILE

# PSReadLine
Import-Module PSReadLine
# Enable Prediction History
Set-PSReadLineOption -PredictionSource History
# Advanced Autocompletion for arrow keys
Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadlineKeyHandler -Key DownArrow -Function HistorySearchForward

zoxide: zoxide is a smarter cd command, inspired by z and autojump.

Github: https://github.com/ajeetdsouza/zoxide

Install:

# not work for me
winget install ajeetdsouza.zoxide

# I use choco
choco install zoxide

Add Config: notepad $PROFILE

# zoxide
Invoke-Expression (& { (zoxide init powershell | Out-String) })

Windows Terminal Hotkeys

OperationHotkey
CopyCtrl + Shift + C
PastCtrl + Shift + V

VSCode

Official Site: https://code.visualstudio.com/

Install

  • Option1: Download Installer from official site.
  • Option2: Install with Chocolatey
# vscode
choco install vscode
# vscodium
choco install vscodium

Preferences

  • Theme: One Dark Pro
  • Icons: Material icon theme
  • Font: JetBrainsMono Nerd Font
  • Auto Save
  • Change Hotkey: Format Document: Shift+Alt+F ---> Alt+F

Codeium

Codeium: A free AI powered toolkit for developers

Official Site: https://codeium.com/

  • Register an account
  • Download extension
  • Login

VSCodium

VSCodium is a community-driven, freely-licensed binary distribution of Microsoft’s editor VS Code.

Microsoft’s vscode source code is open source (MIT-licensed), but the product available for download (Visual Studio Code) is licensed under this not-FLOSS license and contains telemetry/tracking. According to this comment from a Visual Studio Code maintainer.

VSCodium Site: https://vscodium.com/

Warning: VSCodium can not use code command.

Hotkey

Hotkeys May Change due to extension or customizing.

OperationHotkey
Comment/UncommentCtrl + /
Multiline CommentAlt + Shift + A
Copy LineCtrl + L
Move Line Up/DownAlt + up/down
Copy line to Up/DownShift + Alt + up/down
Delete lineCtrl + X
Add / Reduce IndentCtrl + ]/[
New Line at Any PositionCtrl + Enter
Rename VariableCtrl + D (N times)
Format DocumentShift + Alt + F (Alt + F)
Goto File Head/EndCtrl + Home/Ctrl + End
Switch TabCtrl + Tab
Show all symbolsCtrl +Shift + O
Multi CursorAlt + Left Click
Multi CursorCtrl + Alt + Up/Down
Block SelectShift + Alt + Left Drag

Python

Python Official Site: https://www.python.org/downloads/

Install

  • Option1: Download from official site and run installer.
  • Option2: Install with Chocolatey
choco install python

Config

PyPI tuna mirror:

# once
pip install scrapy -i https://pypi.tuna.tsinghua.edu.cn/simple some-package

# set as default
python -m pip install --upgrade pip
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

VSCode Extension

  • Python
  • Black formatter
  • Pylance

conda

👉 conda (miniconda)

Official Site: https://docs.anaconda.com/free/miniconda/miniconda-install/

tuna: https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/

👉 Config

tuna: https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/

edit or create .condarc 。Windows can run conda config --set show_channel_urls yes to generate .condarc then change it:

channels:
  - defaults
show_channel_urls: true
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch-lts: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  deepmodeling: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/

👉 Usage:

# create a environment with specified python version and packages
conda create -n myenv python=3.9 numpy=1.23.5 astropy
# activate the environment:
conda activate myenv

# list envs
conda env list

# export all packages in myenv environment
conda activate myenv
conda env export > myenv.yml

# create a new environment from a myenv.yml
conda env create -f myenv.yml

👉 Windows Terminal:

Add miniconda prompt to windows terminal:

{
  "altGrAliasing": true,
  "antialiasingMode": "grayscale",
  "closeOnExit": "automatic",
  "colorScheme": "Campbell",
  "commandline": "%windir%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -ExecutionPolicy ByPass -NoExit -Command \"& 'C:\\Users\\zuiai\\miniconda3\\shell\\condabin\\conda-hook.ps1' ; conda activate 'C:\\Users\\zuiai\\miniconda3' \"",
  "cursorShape": "bar",
  "font": {
    "size": 12
  },
  "guid": "{3ba1b1d8-9de1-41b7-bb7a-f7903c2e68d6}",
  "hidden": false,
  "historySize": 9001,
  "icon": "ms-appx:///ProfileIcons/{61c54bbd-c2c6-5271-96e7-009a87ff44bf}.png",
  "name": "MiniConda3",
  "padding": "8, 8, 8, 8",
  "snapOnInput": true,
  "startingDirectory": "%USERPROFILE%\\Desktop",
  "useAcrylic": false
}

Docker

Official Site: https://www.docker.com/products/docker-desktop/

Download Link: https://docs.docker.com/desktop/install/windows-install/

Docker Hub:https://hub.docker.com/

Setup WSL 2

Documents:

https://docs.docker.com/desktop/wsl/

https://learn.microsoft.com/en-us/windows/wsl/install

  • Installed the WSL 2 feature on Windows. Search At Start: Turn Windows features on and off, Check both:
Virtual Machine Platform
Windows Subsystem for Linux
  • Update WSL
# install update
wsl --update

Download and install the latest package: WSL2 Linux kernel update package for x64 machines.

  • Install Linux distros.
# list installed Linux distributions and check the version of WSL
wsl -l -v

# install update
wsl --update

# list available distros
wsl -l -o
# install a distro
wsl --install -d <distro name>
# set default distr
wsl --set-default <distro name>

# upgrade the Linux distro to v2
wsl.exe --set-version <distro name> 2
# set v2 as the default version for future installations
wsl.exe --set-default-version 2
  • Set up your Linux user info

Once you have installed WSL, you will need to create a user account and password for your newly installed Linux distribution.

Just run your linux distro from start menu.

Install

Documents:

https://docs.docker.com/desktop/install/windows-install/

https://docs.docker.com/desktop/wsl/

Download and install the latest version of [Docker Desktop for Windows](https://desktop.docker.com/win/main/amd64/Docker Desktop Installer.exe).

Config

Change Mirrors: Settings—Docker Engine

{
  "builder": {
    "gc": {
      "defaultKeepStorage": "20GB",
      "enabled": true
    }
  },
  "experimental": false,
  "registry-mirrors": [
    "https://mirror.ccs.tencentyun.com/"
  ]
}

Possible Error

Installing, this may take a few minutes...
WslRegisterDistribution failed with error: 0x8004032d
Error: 0x8004032d (null)
Press any key to continue...

Solution: Enable Virtual Machine Platform Windows Feature.

Windows Hotkeys

Windows 11 New Features

OperationHotkey
Open Snap LayoutWin + Z
Open Microsoft CopilotWin + C

Document Edit

OperationHotkey
CutCtrl + X
CopyCtrl + C
PasteCtrl + V
Clipboard HistoryWin + V
UndoCtrl + Z
RedoCtrl + Y
BoldCtrl + B
ItalicCtrl + I
UnderlineCtrl + U
Move cursor to Head of lineHome
Move cursor to End of lineEnd
Move cursor to head of next wordCtrl + →
Move cursor to head of previous wordCtrl + ←

Window and Desktop

OperationHotkey
Switch between AppsAlt + Tab
Quit AppAlt + F4
Refresh AppCtrl + R
Hide/Show DesktopWin + D
Lock DesktopWin + L
Switch Input MethodWin + Space
Open Function MenuWin + X
Print ScreenPrtScn
Full ScreenF11

Virtual Desktop

OperationHotkey
Open Task ViewWin + Tab
Add Virtual DesktopWin + Ctrl + D
Switch between Virtual DesktopWin + Ctrl + arrow
Close current Virtual DesktopWin + Ctrl + F4

File Browser

OperationHotkey
Open File BrowserWin + E
RenameF2
Create New FolderCtrl + Shift + N
Delete to Recycle BinDel
Delete ForeverShift + Del
Open Classic ContextShift + RC

Task Bar

OperationHotkey
Open Start MenuWin / Ctrl + ESC
Open / Hide nth App in Task BarWin + [N]
Run as AdministratorCtrl + Shift + LC

Browser

OperationHotkey
FindCtrl + F
Edit UrlAlt + D
Open HistoryCtrl + H
New WindowCtrl + N
New TabCtrl + T
Close Current TabCtrl + W
Recycle TabCtrl + Tab
Print Current pageCtrl + P
ReloadCtrl + R / F5
View SourceF12
ScaleCtrl + Mouse Scroll

Game

OperationHotkey
Open Game ToolsWin + G
Game ShortcutWin + Alt + PrtScn
Game RecordWin + Alt + R
  • 12
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
Windows API 函数参考手册 本书编写组 编著 人民邮电出版社 内容简介 内容简介 本书是关于Microsoft Win32 API 函数的完整参考手册。 本书详细介绍了每一个Win32 API 函数的使用方法,其中着重介绍其原型表示、函数说 明、参数说明、注意事项、相应头文件(.H)、链接库(.LIB 或.DLL)和典型示例。对于每 个函数本书给出了相应的示例部分,这样读者在阅读相应的Win32 API 函数时就能很快地了 解它的具体功能和使用方法,便于更快地掌握该接口函数。 本书是从事Microsoft Windows 操作系统开发和应用人员的必备参考书,也可作为大专 院校相关专业师生自学、教学参考用书。 前 言 前 言 Microsoft Win32 API 是Microsoft Windows 操作系统提供的应用程序接口函数,它基本 上概括了应用程序编程中涉及的每个方面。我们在使用MFC 编程时,所用的MFC 函数都 是封装在Win32 API 基础之上的,即MFC 是Win32 API 的一个上层架构。学习Win32 API 能更深刻的理解MFC 的运作机制,同时使用Win32 API 函数编程要比使用MFC 更灵活, 能编写出更加高效的程序。Microsoft Win32 API 也可以在VB 和Delphi 等语言中使用。 Microsoft Win32 API 函数按照功能划分为窗口处理、设备上下文——DC 、绘图函数、 位图和图标、菜单处理、文件处理、同步、处理文本和字体、硬件和系统、Windows 消息、 进程和线程。 本书按功能对Win32 API 函数进行了划分,对于每一个功能部分的函数都具体给出了它 们的函数原型、功能和用法、注意事项、所在头文件、参数调用和典型示例等信息。本书内 容如下: 第 1 章介绍了Win32 应用程序的一些基本知识,例如系统消息传递机制,图形接口编 程等,同时,它也介绍了Win32 API 函数的一些基本知识。 第2 章介绍了关于窗口处理部分的Win32 API 函数,例如窗口创建,撤销等。 第3 章介绍了设备上下文——DC ,例如创建和获取DC 、坐标变换等。 第4 章介绍了绘图函数,例如路径、图元文件等。 第5 章介绍了位图和图标,例如从DLL 中获取图标,设置DIB 的颜色表等。 第6 章介绍了菜单的处理,例如上下文菜单显示,设置位图菜单项等。 第7 章介绍了文件的处理,例如文件查找,加锁和解锁文件等。 第8 章介绍了同步,例如互斥对象,信号量对象和关键段对象等。 第9 章介绍了文本和字体的处理,例如获取系统中字体的信息,输出各种形式的文本等。 第10 章介绍了硬件和系统,例如捕获鼠标,获取各种系统信息等。 第11 章介绍了Windows 消息,例如消息的获取和发送等。 第12 章介绍了进程和线程,例如调试进程和线程,获取和设置进程和线程的各种信息, 比如优先级、工作集等。 本书为立志掌握 Windows 操作系统编程的人提供了一条有效的捷径,对于不同层次的 Windows 操作系统编程人员来说,本书都极具参考价值,是一本不可多得的参考书。 参与本书的主要编写人员有张鸿超、张宏林等。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值