Powershell(1)

PowerShell

  • cmdlets: Verb-Noun的命令形式, Verb一般是set, get, start, stop, invoke, 使用get-verb显示所有的动词
  • 通过别名机制, 提供了Windows与Unix的命令
  • 可以使用windows原生的命令(mspaint[画图], calc, notepad)
  • 在控制台, 右键复制, 右键粘贴

  • set-location c:  --> cd
  • get-childitem --> ls
  • clear-host --> clear
  • get-alias --> 显示所有别名
    • get-alias -Defination set-location --> 显示set-location的别名是什么
    • get-alias g* --> 显示别名为g开头的是
  • update-help --Force --> 更新帮助系统
  • save-help --> 保存help
  • man, help, get-help name
    * -Detailed
    * -Examples
    * -Online
    * -full
    * -ShowWindow
  • get-verb
  • get-service
    • -Name
    • -DisplayName
  • export-csv --> 导出csv文件
    • -Path String
  • import-csv path --> 将csv文件的内容导入到控制台
  • out-file path --> 导入到哪个文件, >
  • get-content --> cat
  • convertTo-html, convertTo-csv --> 也是将管道的信息转为指定的格式, 但是与export-cvs等不同的是, convertTo是输出到屏幕上的
    exmaple:
    get-service | convertTo-html -property name,status path | out-file repo.html

  • 在命令之后添加-whatif并不会执行命令但是会显示如果执行了的结果
  • -confirm交互
  • get-module -listavaiable
  • get-module --> 显示当前加载的模块
  • select col --> 接受管道, 执行col
  • 在ISE中, ctrl + space只能提示

关于问题检测(通过比较进程报告)

  • export-clixml -Path string --> 导出xml
  • compare-object -ReferenceObject (import-clixml path) -DifferenceObject (get-process) -Property name --> ref指明的一般是一个正常电脑的进程报告

  • mms

windows是面向API的

猜你喜欢

转载自www.cnblogs.com/megachen/p/9504554.html