iT邦幫忙

0

powershell問題

我是powershell初學者,請問以下問題
1.在powershell comlet中的where大都用在何處?
2. ""及''這二個使用的時機差異在哪?
3.因我不會寫程式,該如何有效的學習powershell?

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

2 個回答

4
Ray
iT邦大神 1 級 ‧ 2010-06-11 18:02:01
最佳解答
  1. Where 用在你想要從結果中, 過濾出特定條件, 例如:
    Get-Childitem "C:\Program Files" -recurse | where {$_.extension -eq ".exe"}
    如果沒有 where 的話, 上一個指令將會得到所有檔案, 但透過 where 的過濾, 我們可以只顯示出具有 .exe 尾碼的檔案.

get-process | where { $_.WS -gt 100MB }
前面一個只列出所有的 Process, 但透過 where 就可以過濾出 working set (WS) 超過 100MB 的 process.

  1. 我記得是沒有差別....有錯請指正..

  2. 多找題目來練習, 多看相關的 Blog. 去 Google 搜尋所有的 Powershell 文章出來看...

2
shunyuan
iT邦研究生 1 級 ‧ 2010-06-11 19:50:12

其實 PowerShell 是 MS 在 Windows 平台上跟 Linux shell script (bash) 等價的產品。

Linux 有關 shell script 的資料很多,先懂 Linux shell script 後,PowerShell 的道理是相同的,語法差一點點(或許有的人覺得差很多),學起來就很簡單。

另外 Linux shell script 是每個 MIS 都不可不知道的瑞士刀。忙

我要發表回答

立即登入回答