Powershell(2)
2024-10-21 03:22:35
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执行
- 在每一个帮助信息中的参数都有[]选项, 可以通过get-help *common*, 结果返回一个about_commonparameter的帮助文档, 里面记录的那些是通用的选项
- -verbose
- -debug
- -confirm
- -whatif
注意
- 在windows中为了统一filesystem, wsman, registry等, 通过交item, 文件和文件夹叫item
其他命令
- out-file
- -append
- -width
- -path
- write-eventlog
- write-output
- convertTo-html
- new-alias
- export-alias
- import-alias
- show-command 图形显示, 并且可以执行命令
- test-connection: ping
- get-netfirewallrule
- -direct inbound|outbound
- get-psprovider|get-psdrive: 显示所有的提供程序, wsman, filesystem, register, alias, environment
- get-childitem
- new-item
- remove-item
- set-item
- set-itemproperty: 设置属性, 一般配置get-itemproperty使用
- get-item
- -filter: 过滤掉指定的项
- -literakpath: 不支持通配符
- out-gridview: 将输入发送到图形界面上显示
- export-cvs:
- export-clixml
- -delimiter
- export-clixml
- 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 添加应用日志
最新文章
- Object是什么
- Socket桥(转载)
- ORA-16179: incremental changes to ";log_archive_dest_1"; not allowed with SPFILE
- 慕课网-安卓工程师初养成-2-9 Java中的自动类型转换
- 事件对象event和计时器
- python - 回溯继承树 - 自己实现
- WinDbg调试DMP格式文件
- windows下载安装MariaDB5.5.32 绿色版
- PHP中用PDO方法打开连接关闭mysql数据库
- MAC地址格式小结
- Dlib Python 检测人脸特征点 Face Landmark Detection
- Bellman-Ford算法(在边权可正可负时求最短路)
- Mycat实现mysql主从复制(读写分离)
- jenkins 常见问题汇总
- Mysql SQL优化系列之——执行计划连接方式浅释
- sql培训
- python——简单爬虫
- docker部署nginx,并实现负载均衡。
- 单例模式在生产环境jedis集群中的应用
- 微服务架构eureka集群高可用配置