找到 463 篇文章 關於 PowerShell

如何在 PowerShell 中使用 Get-ChildItem 排除特定檔名?

Chirag Nagrekar
更新於 2020-01-23 07:52:30

3K+ 閱讀量

要排除 Get-ChildItem 輸出結果中顯示的特定檔案,您需要指定檔名。命令Get-ChildItem D:\Temp\ -Recurse -Exclude style.css, LGPO.exe輸出目錄:D:\Temp\LGPO 模式                上次寫入時間         長度 名稱 ----                -------------         ------ ---- -a----       2017-01-06     02:25         638115 LGPO.pdf     目錄:D:\Temp 模式                上次寫入時間         長度 名稱 ----                -------------     ... 閱讀更多

如何在 PowerShell 中使用 Get-ChildItem 排除特定副檔名?

Chirag Nagrekar
更新於 2020-01-23 07:49:27

3K+ 閱讀量

要排除特定副檔名,您需要在 Get-ChildItem 中使用 –Exclude 引數。示例例如,如下所示,當我們執行命令時,它將排除 .html 檔案並顯示其餘檔案。Get-ChildItem D:\Temp\ -Recurse -Exclude *.html輸出目錄:D:\Temp 模式                上次寫入時間         長度 名稱 ----                -------------         ------ ---- d-----       2018-11-24     11:31                LGPO     目錄:D:\Temp\LGPO 模式                上次寫入時間         長度 名稱 ----   ... 閱讀更多

如何在 PowerShell 中使用萬用字元 (*) 搜尋檔案?

Chirag Nagrekar
更新於 2020-01-23 07:48:25

4K+ 閱讀量

您還可以搜尋具有特定名稱的檔案或使用萬用字元 (*) 字元。命令以下命令將搜尋以“Bac”開頭的檔案(包括隱藏檔案)。Get-ChildItem D:\Temp -Recurse -Force -Include Bac*輸出PS C:\WINDOWS\system32> Get-ChildItem D:\Temp -Recurse -Force -Include Bac*     目錄:D:\Temp\GPO_backup\{C9C3DB4C-2E51-4201-B3C3-7C0F1ACECBE9} 模式                上次寫入時間         長度 名稱 ----                -------------         ------ ---- -a----       2018-11-24     11:34           6215 Backup.xml命令當您在兩端都使用萬用字元 (*) 時,檔案 ... 閱讀更多

如何在 PowerShell 中的 Get-ChildItem 中使用萬用字元 (*)?

Chirag Nagrekar
更新於 2020-01-23 07:47:45

3K+ 閱讀量

您還可以搜尋具有特定名稱的檔案或使用萬用字元 (*) 字元。命令以下命令將搜尋以“Bac”開頭的檔案(包括隱藏檔案)。Get-ChildItem D:\Temp -Recurse -Force -Include Bac*輸出PS C:\WINDOWS\system32> Get-ChildItem D:\Temp -Recurse -Force -Include Bac*     目錄:D:\Temp\GPO_backup\{C9C3DB4C-2E51-4201-B3C3-7C0F1ACECBE9} 模式                上次寫入時間         長度 名稱 ----                -------------         ------ ---- -a----       2018-11-24     11:34           6215 Backup.xml命令當您在兩端都使用萬用字元 (*) 時,檔案 ... 閱讀更多

如何在 PowerShell 中使用 Get-ChildItem 搜尋特定副檔名?

Chirag Nagrekar
更新於 2020-01-23 07:47:07

2K+ 閱讀量

要獲取具有特定副檔名的 get-childitem 的輸出,我們需要使用 –include 引數。示例在以下示例中,我們將使用以下指令碼僅獲取 .xml 檔案。Get-ChildItem D:\Temp\ -Recurse -Include *.xml輸出PS C:\WINDOWS\system32> Get-ChildItem D:\Temp\ -Recurse -Include *.xml     目錄:D:\Temp\GPO_backup\{C9C3DB4C-2E51-4201-B3C3-7C0F1ACECBE9} 模式                上次寫入時間         長度 名稱 ----                -------------         ------ ---- -a----       2018-11-24     11:34           6215 Backup.xml -a----       2018-11-24     11:34       ... 閱讀更多

如何在 PowerShell 中使用 Get-ChildItem 篩選特定副檔名?

Chirag Nagrekar
更新於 2020-01-23 07:46:01

17K+ 閱讀量

要獲取具有特定副檔名的 get-childitem 的輸出,我們需要使用 –include 引數。示例在以下示例中,我們將使用以下指令碼僅獲取 .xml 檔案。Get-ChildItem D:\Temp\ -Recurse -Include *.xml輸出PS C:\WINDOWS\system32> Get-ChildItem D:\Temp\ -Recurse -Include *.xml     目錄:D:\Temp\GPO_backup\{C9C3DB4C-2E51-4201-B3C3-7C0F1ACECBE9} 模式                上次寫入時間         長度 名稱 ----                -------------         ------ ---- -a----       2018-11-24     11:34           6215 Backup.xml -a----       2018-11-24     11:34       ... 閱讀更多

PowerShell 中 Get-ChildItem 的 -Force 引數有什麼作用?

Chirag Nagrekar
更新於 2020-01-23 07:41:17

744 閱讀量

要顯示檔案以及隱藏檔案,您需要使用 –Force 引數。命令Get-ChildItem D:\Temp\ -Force輸出如果您看到以上輸出,hiddenfile.xlsx 是隱藏檔案,並且可以透過檔案模式識別,其中 –a-h—是檔案的屬性。您還可以將此引數與 –Recurse 或 –Depth 一起使用。Get-ChildItem D:\Temp\ -Recurse -Force

如何在 PowerShell 中顯示檔案/資料夾(包括隱藏檔案/資料夾)?

Chirag Nagrekar
更新於 2020-01-23 07:40:15

530 閱讀量

要顯示檔案以及隱藏檔案,您需要使用 –Force 引數。命令Get-ChildItem D:\Temp\ -Force輸出如果您看到以上輸出,hiddenfile.xlsx 是隱藏檔案,並且可以透過檔案模式識別,其中 –a-h—是檔案的屬性。您還可以將此引數與 –Recurse 或 –Depth 一起使用。Get-ChildItem D:\Temp\ -Recurse -Force

如何在 PowerShell 中僅獲取隱藏檔案和資料夾?

Chirag Nagrekar
更新於 2020-01-23 07:38:59

1K+ 閱讀量

要僅顯示隱藏檔案和資料夾,在使用 Get-ChildItem 時使用 –hidden 引數。命令Get-ChildItem D:\Temp\ -Hidden輸出PS C:\WINDOWS\system32> Get-ChildItem D:\Temp\ -Hidden     目錄:D:\Temp 模式                上次寫入時間         長度 名稱 ----                -------------         ------ ---- -a-h--       2019-12-13     09:52           6182 Hiddenfile1.xlsx命令類似地,您可以將此 –Hidden 與 –Recurse 或 –Depth 一起使用Get-ChildItem D:\Temp\ -Recurse -Hidden輸出PS C:\WINDOWS\system32> Get-ChildItem D:\Temp\ -Recurse -Hidden     目錄:D:\Temp 模式                上次寫入時間         長度 名稱 ----                -------------         ------ ---- -a-h--       2019-12-13     09:52           6182 Hiddenfile1.xlsx     目錄:D:\Temp\GPO_backup 模式                上次寫入時間         長度 名稱 ----                -------------         ------ ---- -a-h--       2019-12-13     09:52              0 HiddenFile2.txt

如何在 Get-ChildItem PowerShell 中使用 Depth 引數?

Chirag Nagrekar
更新於 2020-01-23 07:38:08

2K+ 閱讀量

當 –Depth 引數與 Get-ChildItem 一起使用時,它控制顯示子資料夾及其內容的遞迴。例如,如果 –Depth 引數設定為 1,則它將僅顯示父資料夾和直接子資料夾的內容,而不是子資料夾的子資料夾。命令當您指定 –Depth 引數時,無需新增 –Recursion 引數。它會自動設定深度級別。Get-ChildItem D:\Temp\ -Depth 1輸出PS C:\WINDOWS\system32> Get-ChildItem D:\Temp\ -Depth 1     目錄:D:\Temp 模式                上次寫入時間         長度 名稱 ----             ... 閱讀更多

廣告

© . All rights reserved.