windows powershell 指令汇总记录

windows powershell指令

不太常用,经常容易忘记,记录一下。


1. 系统信息相关

Get-Help <command>  #获取指令帮助
Get-Command  #获取所有可用指令
Get-Process  #查看当前运行的进程
Get-Service  #系统服务状态
Start-Service <service-name>  #启动某个服务
Stop-Service <service-name>  #停止某个服务
Get-EventLog -LogName System  #查看系统日志

2. 文件与文件夹管理

Get-FileHash  <filePath>  -Algorithm MD5  #查看某个文件的md5码
Get-ChildItem <path>  #列出目录内容,也可以使用ls
New-Item -Path <path> -Name "newfile.txt" -ItemType "file" #创建新文件或文件夹
Set-Location <path>#更改当前目录,也可以用cd
Copy-Item <srcPath> <desPath> #复制文件或文件夹
Move-Item <srcPath> <desPath> #移动文件或文件夹
Remove-Item <filePath> #删除文件或文件夹,也可以用del

3. 文件权限与属性

Get-Acl <filePath> #查看文件或文件夹的访问控制列表 (ACL)
Set-Acl <filePath> #修改文件或文件夹的访问权限

4. 网络相关

Test-Connection url #测试网络连接(类似于 ping)
Get-NetIPAddress #查看网络适配器的 IP 地址信息
Get-NetAdapter #查看网络适配器的状态
Set-NetIPAddress -InterfaceAlias "Ethernet" -IPAddress "192.168.1.100" -PrefixLength 24 #配置网络适配器的 IP 地址
posted @ 2026-06-16 11:41  AAA晒网打鱼工程师x工  阅读(10)  评论(0)    收藏  举报