日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > windows >内容正文

windows

读Getting Started With Windows PowerShell笔记

發布時間:2023/12/4 windows 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 读Getting Started With Windows PowerShell笔记 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
使用中Powershell的操作跟Linux中的終端操作很多地方是一致的,當然,還是有著Windows自己的特色,比如,不分大小寫。之前命令行中的命令大部分在這里也可以用,而且用法一樣。 選中后點右鍵,即復制到剪切板。 不分大小寫,以下的幾個都是一樣的命令:Get-Aliasget-aliasgeT-ALIaS輸命令時可以用Tab鍵補全。 可以加管道控制符,以及加more分屏輸出:PS C:\Windows\system32> get-alias | moreCommandType Name ModuleName----------- ---- ----------Alias % -> ForEach-ObjectAlias ? -> Where-ObjectAlias ac -> Add-ContentAlias asnp -> Add-PSSnapinAlias cat -> Get-ContentAlias cd -> Set-LocationAlias chdir -> Set-LocationAlias clc -> Clear-ContentAlias clear -> Clear-HostAlias clhy -> Clear-HistoryAlias cli -> Clear-ItemAlias clp -> Clear-ItemPropertyAlias cls -> Clear-HostAlias clv -> Clear-VariableAlias cnsn -> Connect-PSSessionAlias compare -> Compare-ObjectAlias copy -> Copy-ItemAlias cp -> Copy-ItemAlias cpi -> Copy-ItemAlias cpp -> Copy-ItemPropertyAlias cvpa -> Convert-PathAlias dbp -> Disable-PSBreakpointAlias del -> Remove-ItemAlias diff -> Compare-ObjectAlias dir -> Get-ChildItemAlias dnsn -> Disconnect-PSSessionAlias ebp -> Enable-PSBreakpointAlias echo -> Write-OutputAlias epal -> Export-AliasAlias epcsv -> Export-CsvAlias epsn -> Export-PSSessionAlias erase -> Remove-ItemAlias etsn -> Enter-PSSessionAlias exsn -> Exit-PSSessionAlias fc -> Format-CustomAlias fl -> Format-ListAlias foreach -> ForEach-ObjectAlias ft -> Format-TableAlias fw -> Format-WideAlias gal -> Get-AliasAlias gbp -> Get-PSBreakpointAlias gc -> Get-ContentAlias gci -> Get-ChildItemAlias gcm -> Get-CommandAlias gcs -> Get-PSCallStackAlias gdr -> Get-PSDrive-- More --同樣的是回車往下一行,空格往下一屏。Ctrl+c,中止執行。 Alias也是給這些cmdlet起個別名,或者,叫昵稱?比如下面的三個,都是完全一樣的結果,倒是更方便了。PS C:\Windows\system32> d:PS D:\> dir目錄: D:\Mode LastWriteTime Length Name---- ------------- ------ ----da--- 2007/4/17 10:43 Dynamips@EDURainbowd---- 2012/12/1 10:22 My Documentsd---- 2012/11/7 10:38 NeoSpeechd---- 2012/11/10 9:17 Program Filesd---- 2012/11/29 21:58 Program Files (x86)PS D:\> ls目錄: D:\Mode LastWriteTime Length Name---- ------------- ------ ----da--- 2007/4/17 10:43 Dynamips@EDURainbowd---- 2012/12/1 10:22 My Documentsd---- 2012/11/7 10:38 NeoSpeechd---- 2012/11/10 9:17 Program Filesd---- 2012/11/29 21:58 Program Files (x86)PS D:\> get-childitem目錄: D:\Mode LastWriteTime Length Name---- ------------- ------ ----da--- 2007/4/17 10:43 Dynamips@EDURainbowd---- 2012/12/1 10:22 My Documentsd---- 2012/11/7 10:38 NeoSpeechd---- 2012/11/10 9:17 Program Filesd---- 2012/11/29 21:58 Program Files (x86)也可以加其他參數,參數可以只輸前幾個字母,只要沒有其他的參數的跟這些字母重復,造成不知道是哪個:PS C:\Users\Denny> get-childitem -recurse | more目錄: C:\Users\DennyMode LastWriteTime Length Name---- ------------- ------ ----d---- 2012/11/8 15:52 .sdtguid-r-- 2012/11/5 21:35 Contactsd-r-- 2012/12/5 9:11 Desktopd-r-- 2012/11/15 16:51 Documentsd-r-- 2012/12/4 21:30 Downloadsd-r-- 2012/11/5 21:35 Favoritesd-r-- 2012/11/5 21:35 Linksd-r-- 2012/11/5 21:35 Musicd-r-- 2012/11/14 8:52 Picturesd-r-- 2012/11/5 21:35 Saved Gamesd-r-- 2012/11/6 9:30 Searchesd-r-- 2012/11/5 21:35 Videos-a--- 2012/11/23 9:16 11216 dlclient.history-a--- 2012/11/23 9:16 167 dlclient.localstate-a--- 2012/11/23 9:16 732 dlgmanager.config-a--- 2012/11/8 15:52 100 sapinstAuth.txt目錄: C:\Users\Denny\.sdtguiMode LastWriteTime Length Name---- ------------- ------ ----d---- 2012/11/8 15:52 downloadd---- 2012/11/8 15:52 historyd---- 2012/11/8 15:52 htdocd---- 2012/11/8 15:52 log-a--- 2012/11/8 15:52 1187 .sdt_keystore_nw2007目錄: C:\Users\Denny\.sdtgui\logMode LastWriteTime Length Name---- ------------- ------ -----a--- 2012/11/8 15:52 480 FileService.log-a--- 2012/11/8 15:52 42 frog.log-a--- 2012/11/8 15:52 484 NotesService.log-a--- 2012/11/8 15:52 836 SAPinstService.log-a--- 2012/11/8 15:52 3829 sdtgui.log-a--- 2012/11/8 15:52 0 sdtgui.out-a--- 2012/11/8 15:52 0 sdtgui.trc-- More -- 列出下面所有子文件夾的文件。 輸出命令信息:PS C:\Users\Denny> get-command | moreCommandType Name ModuleName----------- ---- ----------Alias Add-ProvisionedAppxPackage DismAlias Apply-WindowsUnattend DismAlias Get-ProvisionedAppxPackage DismAlias Initialize-Volume StorageAlias Remove-ProvisionedAppxPackage DismFunction A:Function Add-BCDataCacheExtension BranchCacheFunction Add-BitLockerKeyProtector BitLockerFunction Add-DnsClientNrptRule DnsClientFunction Add-DtcClusterTMMapping MsDtcFunction Add-InitiatorIdToMaskingSet StorageFunction Add-NetIPHttpsCertBinding NetworkTransitionFunction Add-NetLbfoTeamMember NetLbfoFunction Add-NetLbfoTeamNic NetLbfoFunction Add-NetSwitchTeamMember NetSwitchTeamFunction Add-OdbcDsn WdacFunction Add-PartitionAccessPath StorageFunction Add-PhysicalDisk StorageFunction Add-Printer PrintManagementFunction Add-PrinterDriver PrintManagementFunction Add-PrinterPort PrintManagement以格式控制列出:PS C:\Users\Denny> Get-Command | Format-List | moreDisplayName : Add-ProvisionedAppxPackageCommandType : AliasDefinition :ReferencedCommand :ResolvedCommand :DisplayName : Apply-WindowsUnattendCommandType : AliasDefinition :ReferencedCommand :ResolvedCommand :DisplayName : Get-ProvisionedAppxPackageCommandType : AliasDefinition :ReferencedCommand :ResolvedCommand :DisplayName : Initialize-VolumeCommandType : AliasDefinition :ReferencedCommand :ResolvedCommand :DisplayName : Remove-ProvisionedAppxPackageCommandType : AliasDefinition :ReferencedCommand :ResolvedCommand :幫助信息:PS C:\Users\Denny> get-help format-list名稱Format-List語法Format-List [[-Property] <Object[]>] [-GroupBy <Object>] [-View <string>] [-ShowError] [-DisplayError] [-Force] [-Expand <string> {CoreOnly | EnumOnly | Both}] [-InputObject <psobject>] [<CommonParameters>]別名fl備注Get-Help 在此計算機上找不到該 cmdlet 的幫助文件。它僅顯示部分幫助。-- 若要下載并安裝包含此 cmdlet 的模塊的幫助文件,請使用 Update-Help。-- 若要聯機查看此 cmdlet 的幫助主題,請鍵入: "Get-Help Format-List -Online" 或轉到 http://go.microsoft.com/fwlink/?LinkID=113302。其中下面的那個鏈接則是直接到format-list的幫助信息的。 安裝本地幫助:PS C:\Users\Denny> update-help 提示需要以管理員身份運行才能更新這些幫助信息: 還有報錯,不過只是一小部分,暫時用不上: 終于出來了:PS C:\Windows\system32> get-help format-list名稱Format-List摘要Formats the output as a list of properties in which each property appears on a new line.語法Format-List [[-Property] <Object[]>] [-DisplayError [<SwitchParameter>]] [-Expand <String>] [-Force [<SwitchParameter>]] [-GroupBy <Object>] [-InputObject <PSObject>] [-ShowError [<SwitchParameter>]] [-View <String>] [<CommonParameters>]說明The Format-List cmdlet formats the output of a command as a list of properties in which each property is displayedon a separate line. You can use Format-List to format and display all or selected properties of an object as a list(format-list *).Because more space is available for each item in a list than in a table, Windows PowerShell displays more properties of the object in the list, and the property values are less likely to be truncated.相關鏈接Online Version: http://go.microsoft.com/fwlink/?LinkID=113302備注若要查看示例,請鍵入: "get-help Format-List -examples".有關詳細信息,請鍵入: "get-help Format-List -detailed".若要獲取技術信息,請鍵入: "get-help Format-List -full".有關在線幫助,請鍵入: "get-help Format-List -online"加參數的命令,得到使用的例子:PS C:\Users\Denny> Get-Help Format-List -Examples名稱Format-List摘要Formats the output as a list of properties in which each property appears on a new line.-------------------------- EXAMPLE 1 --------------------------PS C:\> get-service | format-listThis command formats information about services on the computer as a list. By default, the services are formatted as a table. The Get-Service cmdlet gets objects representing the services on the computer. The pipeline operator (|)passes the results through the pipeline to Format-List. Then, the Format-List command formats the service information in a list and sends it to the default output cmdlet for display.-------------------------- EXAMPLE 2 --------------------------PS C:\> $a = get-childitem $pshome\*.ps1xmlPS C:\>format-list -InputObject $aThese commands display information about the PS1XML files in the Windows PowerShell directory as a list.The first command gets the objects representing the files and stores them in the $a variable.The second command uses Format-List to format information about objects stored in $a. This command uses the InputObject parameter to pass the variable to Format-List, which then sends the formatted output to the default output cmdlet for display.-------------------------- EXAMPLE 3 --------------------------PS C:\> get-process | format-list -property name, basepriority, priorityclassThis command displays the name, base priority, and priority class of each process on the computer. It uses the Get-Process cmdlet to get an object representing each process. The pipeline operator (|) passes the process objects through the pipeline to Format-List. Format-List formats the processes as a list of the specified properties. The "Property" parameter name is optional, so you can omit it.-------------------------- EXAMPLE 4 --------------------------PS C:\> get-process winlogon | format-list -property *This command displays all of the properties of the Winlogon process. It uses the Get-Process cmdlet to get an object representing the Winlogon process. The pipeline operator (|) passes the Winlogon process object through the pipeline to Format-List. The command uses the Property parameter to specify the properties and the * to indicate all properties. Because the name of the Property parameter is optional, you can omit it and type the command as: "format-list *". Format-List automatically sends the results to the default output cmdlet for display.

轉載于:https://blog.51cto.com/lightguide/1078859

總結

以上是生活随笔為你收集整理的读Getting Started With Windows PowerShell笔记的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。