Powershell常用命令

# Powershell常用命令

> 原文:[https://www.zhihuifly.com/t/topic/3634](https://www.zhihuifly.com/t/topic/3634)

# Powershell常用命令

“`
get-host或$host.version或$PSVersionTable.PSVERSION 查看powershell版本

New-Item test -type Directory 新建目录

New-Item test -type File 新建文件

Remove-Item 文件或目录 删除文件或目录

get-content 1.txt 显示文本内容

set-content 1.txt -value “helloword” 设置文件内容

add-content 1.txt -value “love” 追加文本内容

Get-ExecutionPolicy 查看powershell执行策略

Set-ExecutionPolicy Unrestricted 设置powershell执行策略

“`
Restricted 为脚本不能运行,是默认设置

Unrestricted 为允许所有的脚本运行

RemoteSigned 为只能运行本地创建的脚本,不能运行从网上下载的脚本,除了有数字签名证书

Allsigned 为只运行有受信任的发布者签名的脚本
“`

get-process 获取所有进程

Set-Alias 例如Set-Alias aaa get-process 给命令起别名 `Get-Command 查看当前作用域支持的所有命令`
“`

© 版权声明
THE END
喜欢就支持一下吧
点赞0赞赏 分享
评论 抢沙发

请登录后发表评论

    请登录后查看评论内容