Skip to content

windows系统操作

cmd

cmd.exe 一些常见的启动参数介绍_脚本教程网 (xiuzhanwang.com)

/c

cmd /c "python E:/run/sendmail.py "%V""

运行之后自动结束进程

/k

运行之后不自动结束

start /min

最小化运行, 不出现窗口

cmd /c start /min cmd /c (python E:/run/sendmail.py "%V")

隐藏CMD运行

调用cmd命令不显示命令窗口_Jakou的博客-CSDN博客_cmd 不显示窗口

CMD隐藏黑窗口运行_linuxbugs的博客-CSDN博客_cmd隐藏运行程序

如何在不显示窗口的情况下运行 PowerShell 脚本?(How to run a PowerShell script without displaying a window?)答案 - 爱码网 (likecs.com)

安卓子系统安装命令

windows11恢复windows10版本右键菜单

直接显示更多选项

reg.exe add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32"

获取桌面路径

获取桌面的绝对路径

reg query "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v Desktop
@echo off 

SET DESKTOP_REG_ENTRY="HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" 
SET DESKTOP_REG_KEY="Desktop" 
SET DESKTOP_DIR= 

FOR /F "tokens=1,2*" %%a IN ('REG QUERY %DESKTOP_REG_ENTRY% /v %DESKTOP_REG_KEY% ^| FINDSTR "REG_SZ"') DO (
    set DESKTOP_DIR="%%c" 
) 

ECHO Desktop dir: %DESKTOP_DIR% 
PAUSE

bat不存在文件夹路径,则创建文件夹

if not exist demo\a md demo\a
if exist demo\a (
    echo 此文件夹已存在
) else (
    md demo\a
    echo 文件夹已创建
)

bat获取输入信息

set /p commitInfo=提交信息:

bat时间等待1秒钟

timeout /t 1 /nobreak

/nobreak表示忽视任意按键跳过等待

powershell下载命令

wget http://147.139.45.199/download/Miniconda3-py38_4.10.3-Windows-x86_64.exe -OutFile anaconda.exe

conda设置清华镜像

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro/

powershell设置可以执行ps1脚本

以管理员形式运行powershell,并执行:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned

android设置dl.google.com

访问不了google解决

windows11安装wsa

1 在https://store.rg-adguard.net/里搜索www.microsoft.com/store/productid/9p3395vx91nr 选择Slow

2 下载MicrosoftCorporationII.WindowsSubsystemForAndroid_2203.40000.1.0_neutral_~_8wekyb3d8bbwe.msixbundle ,

若提示报错, 可以再按需下载

Microsoft.UI.Xaml.2.6_2.62112.3002.0_x64__8wekyb3d8bbwe.appx

Microsoft.VCLibs.140.00.UWPDesktop_14.0.30704.0_x64__8wekyb3d8bbwe.appx

3 以管理员打开powershell执行命令

Add-AppxPackage "E:\files\Downloads\MicrosoftCorporationII.WindowsSubsystemForAndroid_2203.40000.1.0_neutral___8wekyb3d8bbwe.Msixbundle"

4 adb

adb connect 127.0.0.1:58526

adb安装apk

adb install "E:\files\Downloads\Coolapk-12.1.1-2203211-coolapk-app-sign.apk"

node环境变量配置

npm config set cache "D:\software\node_14.17.3\node_cache"
npm config set prefix "D:\software\node_14.17.3\node_global"

vscode关闭受限模式

搜索security.workspace.trust, 勾选掉控制是否在vscode内启用工作区信任

image-20220330012855647

powershell设置命令行颜色

function prompt {
    Write-Host $env:USERNAME -ForegroundColor Green -NoNewline
    Write-Host "@" -NoNewline
    Write-Host $env:COMPUTERNAME -ForegroundColor Blue -NoNewline
    Write-Host " $((Get-Date).toString('yyyy-MM-dd hh:mm:ss'))" -ForegroundColor DarkMagenta -NoNewline 
    Write-Host ":" -NoNewline
    Write-Host $($executionContext.SessionState.Path.CurrentLocation) -ForegroundColor Blue -NoNewline 
    "$('>' * ($nestedPromptLevel + 1)) "
}

powershell设置

服务端配置

winrm quickconfig
Get-Service WinRM
Enable-PSRemoting

客户端配置

将服务端主机host添加到本地

cd WSMan::localhost\client
Get-ChildItem
Set-Item ./TrustedHosts 192.168.1.10
# 将所有hosts添加到本地
Set-Item ./TrustedHosts *

远程命令

Enter-PSSession 192.168.1.10 -Credential (Get-Credential)

自动化远程命令

windows管理方式 - 阳光-源泉 - 博客园 (cnblogs.com)

测试远程服务是否开启

Test-WsMan 192.168.1.10

Windows Terminal 完美配置 PowerShell 7.1 - 知乎 (zhihu.com)

poershell添加到右键菜单

powershell.exe -noexit -command Set-Location -literalPath '%V'

pandoc以引文格式导出文件

潘多克 - 潘多克用户指南 (pandoc.org)

pandoc --reference-doc E:/files/Desktop/heiti.docx python.md -o E:/files/Desktop/py.docx

代码块使用Source Code样式

CMD UI风格

一 PowerShell

屏幕背景

39 40 34

屏幕文字

黄色: 166 226 42

二 CMD

蓝色: 59 120 255

红色: 231 72 86