常用 Windows 命令

目录

  1. 常用 Windows 命令

    1. 通过 powershell 执行命令

    2. 解压

    3. 安装 vim

    4. 下载补丁

    5. 设置接口 MTU

    6. 查看环境变量

    7. 使用环境变量

    8. 查看文件 MD5

通过 powershell 执行命令

powershell -command echo 123

解压

Expand-Archive -Path c:\wordpress.zip -DestinationPath "C:\tools\nginx-1.17.10\html"

安装 vim

powershell -command Set-ExecutionPolicy Bypass -Scope Process -Force; \
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) ; choco install -y vim

下载补丁

https://www.catalog.update.microsoft.com/Search.aspx

可以直接搜索KB号来进行下载安装

设置接口 MTU

# 查看接口名称
PS C:\Users\Administrator> netsh interface ipv4 show subinterface

   MTU  MediaSenseState   传入字节  传出字节      接口
------  ---------------  ---------  ---------  -------------
4294967295                1          0      57153  Loopback Pseudo-Interface 1
  1000                1  46756283188  136367354516  Ethernet0-50.x
  1500                1    9539517    9369724  Ethernet1-192.168
  1500                1    4737161    5947452  Ethernet3
  1500                1    4707464    6032374  Ethernet4

# 设置 MTU: netsh interface ipv4 set subinterface Ethernet3 MTU=1500 store=persistent
PS C:\Users\Administrator> netsh interface ipv4 set subinterface Ethernet3 MTU=1500 store=persistent
确定。

查看环境变量

 get-item env:

Name                           Value
----                           -----
COMPUTERNAME                   iZno0fcxdyi00kZ
USERPROFILE                    C:\Users\Administrator
HOMEPATH                       \Users\Administrator
LOCALAPPDATA                   C:\Users\Administrator\AppData\Local
PSModulePath                   C:\Users\Administrator\Documents\WindowsPowerShell\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\...
PROCESSOR_ARCHITECTURE         AMD64
Path                           C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Users\Adminis...
CommonProgramFiles(x86)        C:\Program Files (x86)\Common Files
ProgramFiles(x86)              C:\Program Files (x86)
PROCESSOR_LEVEL                6
LOGONSERVER                    \\iZno0fcxdyi00kZ
PATHEXT                        .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL
HOMEDRIVE                      C:
SystemRoot                     C:\Windows
ALLUSERSPROFILE                C:\ProgramData
DriverData                     C:\Windows\System32\Drivers\DriverData
APPDATA                        C:\Users\Administrator\AppData\Roaming
PROCESSOR_REVISION             5507
USERNAME                       Administrator
CommonProgramW6432             C:\Program Files\Common Files
CommonProgramFiles             C:\Program Files\Common Files
OS                             Windows_NT
USERDOMAIN_ROAMINGPROFILE      IZNO0FCXDYI00KZ
PROCESSOR_IDENTIFIER           Intel64 Family 6 Model 85 Stepping 7, GenuineIntel
ComSpec                        C:\Windows\system32\cmd.exe
SystemDrive                    C:
TEMP                           C:\Users\ADMINI~1\AppData\Local\Temp
ProgramFiles                   C:\Program Files
NUMBER_OF_PROCESSORS           2
TMP                            C:\Users\ADMINI~1\AppData\Local\Temp
ProgramData                    C:\ProgramData
ProgramW6432                   C:\Program Files
windir                         C:\Windows
USERDOMAIN                     IZNO0FCXDYI00KZ
PUBLIC                         C:\Users\Public

使用环境变量

PS C:\Users\Administrator> $env:HOMEPATH
\Users\Administrator

查看文件 MD5

certutil -hashfile xxx MD5