麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 開發 > PowerShell > 正文

你應該選擇 Powershell 的10個理由(拋棄 cmd)

2020-05-30 20:21:31
字體:
來源:轉載
供稿:網友

Powershell 從 Windows7 時代開始內置于 Windows 系統當中,可以看作是微軟對 cmd 的大升級,目前兩者并存于 Windows 系統中。

首先強烈推薦一個 powershell 學習網站:

powershell在線教程

1. powershell 更加 “powerful”

微軟起“powershell”這個名字雖然有吹牛逼的嫌疑(我以前也這樣想),但從事實來看并非如此。powershell 的強大程度分分鐘秒殺 Linux 上的 bash,更不要說飽受詬病的 cmd 了。(無意打廣告)

2. powershell 全面支持面向對象

powershell 背后依靠的是一套完整的 .NET 編程體系,其腳本更容易編寫且穩健性大大提升。反過來看 cmd,那些完全由各種命令堆砌而成的一條條指令簡直就是“小打小鬧”。

3. 從 cmd 遷移到 powershell 成本幾乎為零

如果你對老朋友 cmd 充滿情懷,無法舍棄,完全無妨!因為 powershell 可以看作 cmd 的超集,所有的常用命令諸如dir, cd, ipconfig等在 powershell 中都能直接使用。但背后的實現方式是完全不同的,powershell 基于完全的面向對象,它通過給函數和對象“起別名”的方式來支持這些舊的命令。

4. 誘人的管道操作

管道操作的靈感來自 Linux 的 shell,但由于 powershell 將一切都包裝成為對象,而不是直接處理字符串,因此其管道操作的靈活程度遠在 Linux 的 shell 之上。

例如:

PS C:/Users/Haley> ls | sort -Descending Name | Format-Table Name,ModeName              Mode----              ----VirtualBox VMs         d-----Videos             d-r---Searches            d-r---Saved Games          d-r---Pictures            d-r---OneDrive            d-r---Music             d-r---Links             d-r---

這條命令列出當前路徑下的所有文件,按照名稱降序排序,并以表格的形式輸出,且只顯示Name和Mode兩個字段。

5. 絕對完備的幫助文檔

任何函數與對象都能夠通過help *命令來查看其幫助文檔(準確來說應該是Get-Help函數,這是更加“面向對象”化的命名方式,而help是它的別名),如果看不明白,加上-examples參數會有應用實例,如果仍看不明白,加上-online參數會打開完整的在線幫助文檔,不得不佩服,微軟的一條龍服務做的很到位。

例如,關于ls的幫助文檔如下:

PS C:/Users/Haley> help ls名稱  Get-ChildItem摘要  Gets the items and child items in one or more specified locations.語法  Get-ChildItem [[-Filter] <String>] [-Attributes {ReadOnly | Hidden | System | Directory | Archive | Device | Normal   | Temporary | SparseFile | ReparsePoint | Compressed | Offline | NotContentIndexed | Encrypted | IntegrityStream |   NoScrubData}] [-Depth <UInt32>] [-Directory] [-Exclude <String[]>] [-File] [-Force] [-Hidden] [-Include <String[]>  ] -LiteralPath <String[]> [-Name] [-ReadOnly] [-Recurse] [-System] [-UseTransaction] [<CommonParameters>]  Get-ChildItem [[-Path] <String[]>] [[-Filter] <String>] [-Attributes {ReadOnly | Hidden | System | Directory | Arch  ive | Device | Normal | Temporary | SparseFile | ReparsePoint | Compressed | Offline | NotContentIndexed | Encrypte  d | IntegrityStream | NoScrubData}] [-Depth <UInt32>] [-Directory] [-Exclude <String[]>] [-File] [-Force] [-Hidden]   [-Include <String[]>] [-Name] [-ReadOnly] [-Recurse] [-System] [-UseTransaction] [<CommonParameters>]說明  The Get-ChildItem cmdlet gets the items in one or more specified locations. If the item is a container, it gets the   items inside the container, known as child items. You can use the Recurse parameter to get items in all child cont  ainers.  A location can be a file system location, such as a directory, or a location exposed by a different Windows PowerSh  ell provider, such as a registry hive or a certificate store.相關鏈接  Online Version: http://go.microsoft.com/fwlink/?LinkId=821580  Get-Item  Get-Location  Get-Process  Get-PSProvider備注  若要查看示例,請鍵入: "get-help Get-ChildItem -examples".  有關詳細信息,請鍵入: "get-help Get-ChildItem -detailed".  若要獲取技術信息,請鍵入: "get-help Get-ChildItem -full".  有關在線幫助,請鍵入: "get-help Get-ChildItem -online"            
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 精品国产一区二区在线 | 日本成人二区 | 欧美成人性生活片 | 日本中文字幕网址 | 欧美国产精品一区二区 | 国产精品久久久久久久久久久天堂 | 最新91在线视频 | 欧洲精品久久 | 免费a观看 | 91成人免费网站 | 看免费5xxaaa毛片 | 成人三级免费电影 | 第一区免费在线观看 | 永久免费av在线 | 久久精品99北条麻妃 | 国产精品一区在线观看 | 日日操日日操 | av电影免费观看 | 最新午夜综合福利视频 | 日韩视频一区二区三区四区 | 免费观看黄色一级视频 | 成人在线观看免费视频 | 午夜精品福利在线观看 | 欧美成人高清视频 | 亚洲成人福利在线 | 国产手机国产手机在线 | 宅男噜噜噜66国产在线观看 | 一区二区三区黄色 | 久草在线综合 | 中文字幕涩涩久久乱小说 | 91午夜理伦私人影院 | 天天操天天碰 | 免费毛片免费看 | 久久久久久久爱 | 欧美日韩中文字幕在线 | 久草在线手机视频 | 中文字幕涩涩久久乱小说 | 国产精品久久久久久久久久久天堂 | 一本在线高清码电影 | 久久成人国产精品入口 | 国产精品久久久久久久久久东京 |