Powershell(2)
其他
2018-08-20 11:37:54
阅读次数: 0
powershell(2)
帮助系统(显示出来的参数语法要比Unix中help复杂)
- save-help -destinationpath c:\help
- update-help -force -sourcepath c:\help
- get-command -noun *log* -verb get -commandtype cmdlet|all|application
- [-arg] 为位置参数, 必须写在特定的位置
- [[-arg]] 可选又位置, 可以不写, 但是写了就要在特定的位置
- -arg 不是位置参数, 一定要写, 但是对位置没有要求
- (get-content C:\demp.txt) ()中的优先级高, 强制限制性, 与Unix不同, Unix中是打开一个子shell执行
- 在每一个帮助信息中的参数都有[
注意
- 在windows中为了统一filesystem, wsman, registry等, 通过交item, 文件和文件夹叫item
其他命令
- out-file
- write-eventlog
- write-output
- convertTo-html
- new-alias
- export-alias
- import-alias
- show-command 图形显示, 并且可以执行命令
- test-connection: ping
- get-netfirewallrule
- get-psprovider|get-psdrive: 显示所有的提供程序, wsman, filesystem, register, alias, environment
- get-childitem
- new-item
- remove-item
- set-item
- set-itemproperty: 设置属性, 一般配置get-itemproperty使用
- get-item
- -literakpath: 不支持通配符
- out-gridview: 将输入发送到图形界面上显示
- export-cvs:
- format-custom: 展开层级
实验(1)
- get-process | sort-object -property vm -decending | select-obejct -index 0,1,2,3,4 消耗内存前五名
- get-services | select-object -property name, status | sort-object -property status -descending | export-csv services.csv
- set-service -name bits -startiuptype manual
- get-history -id 5 | invoke-history
- new-eventlog -logname game -source cs 添加应用日志
转载自www.cnblogs.com/megachen/p/9504565.html