找到 2042 篇文章,關於 Microsoft 技術

如何在 PowerShell 中使用 Get-ChildItem 獲取系統檔案?

Chirag Nagrekar
更新於 2020-01-23 07:54:19

1K+ 瀏覽量

系統檔案是作業系統檔案,預設情況下使用 Get-ChildItem 無法看到。要獲取系統檔案,需要使用 –System 引數。示例例如,以下命令將為您提供 C:\Windows\System32 下的系統檔案和資料夾。PS C:\WINDOWS\system32> Get-ChildItem -SystemOutputDirectory: C:\WINDOWS\system32 Mode                LastWriteTime         Length Name ----                -------------         ------ ---- d---s-       25-12-2019     01:14                AppV d---s-       19-03-2019     10:22           ... 閱讀更多

如何在 PowerShell 中使用 Get-ChildItem 獲取只讀檔案?

Chirag Nagrekar
更新於 2020-01-23 07:53:04

1K+ 瀏覽量

要在 PowerShell 中使用 Get-ChildItem 獲取只讀檔案,需要使用 –Readonly 檔案。只讀檔案具有屬性“r”。在下面的示例中,您可以檢查檔案的屬性。Get-ChildItem D:\Temp\ -ReadOnlyOutputPS C:\WINDOWS\system32> Get-ChildItem D:\Temp\* -ReadOnly     Directory: D:\Temp Mode                LastWriteTime         Length Name ----                -------------         ------ ---- -ar---       13-01-2020     18:19              0 Readonlyfile.txt您可以檢查 Mode 屬性中的只讀屬性值。

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

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

3K+ 瀏覽量

要排除 Get-ChildItem 輸出中顯示的特定檔案,需要指定檔名。命令Get-ChildItem D:\Temp\ -Recurse -Exclude style.css, LGPO.exeOutputDirectory: D:\Temp\LGPO Mode                LastWriteTime         Length Name ----                -------------         ------ ---- -a----       01-06-2017     02:25         638115 LGPO.pdf     Directory: D:\Temp Mode                LastWriteTime         Length Name ----     ... 閱讀更多

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

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

3K+ 瀏覽量

要排除特定副檔名,需要在 Get-ChildItem 中使用 –Exclude 引數。示例例如,如下所示,當我們執行命令時,它將排除 .html 檔案並顯示其餘檔案。Get-ChildItem D:\Temp\ -Recurse -Exclude *.htmlOutputDirectory: D:\Temp Mode                LastWriteTime         Length Name ----                -------------         ------ ---- d-----       24-11-2018     11:31                LGPO     Directory: D:\Temp\LGPO Mode                LastWriteTime         Length Name ---- ... 閱讀更多

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

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

4K+ 瀏覽量

您還可以搜尋特定名稱的檔案或使用萬用字元 (*) 字元。命令以下命令將搜尋以“Bac”開頭的檔案(包括隱藏檔案)。Get-ChildItem D:\Temp -Recurse -Force -Include Bac*OutputPS C:\WINDOWS\system32> Get-ChildItem D:\Temp -Recurse -Force -Include Bac*     Directory: D:\Temp\GPO_backup\{C9C3DB4C-2E51-4201-B3C3-7C0F1ACECBE9} Mode                LastWriteTime         Length Name ----                -------------         ------ ---- -a----       24-11-2018     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*OutputPS C:\WINDOWS\system32> Get-ChildItem D:\Temp -Recurse -Force -Include Bac*     Directory: D:\Temp\GPO_backup\{C9C3DB4C-2E51-4201-B3C3-7C0F1ACECBE9} Mode                LastWriteTime         Length Name ----                -------------         ------ ---- -a----       24-11-2018     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 *.xmlOutputPS C:\WINDOWS\system32> Get-ChildItem D:\Temp\ -Recurse -Include *.xml     Directory: D:\Temp\GPO_backup\{C9C3DB4C-2E51-4201-B3C3-7C0F1ACECBE9} Mode                LastWriteTime         Length Name ----                -------------         ------ ---- -a----       24-11-2018     11:34           6215 Backup.xml -a----       24-11-2018     11:34       ... 閱讀更多

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

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

17K+ 瀏覽量

要獲取具有特定副檔名的 get-childitem 的輸出,我們需要使用 –include 引數。示例在下面的示例中,我們將使用以下指令碼僅獲取 .xml 檔案。Get-ChildItem D:\Temp\ -Recurse -Include *.xmlOutputPS C:\WINDOWS\system32> Get-ChildItem D:\Temp\ -Recurse -Include *.xml     Directory: D:\Temp\GPO_backup\{C9C3DB4C-2E51-4201-B3C3-7C0F1ACECBE9} Mode                LastWriteTime         Length Name ----                -------------         ------ ---- -a----       24-11-2018     11:34           6215 Backup.xml -a----       24-11-2018     11:34       ... 閱讀更多

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

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

744 瀏覽量

要顯示檔案以及隱藏檔案,需要使用 –Force 引數。命令Get-ChildItem D:\Temp\ -ForceOutput如果檢視以上輸出,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\ -ForceOutput如果檢視以上輸出,hiddenfile.xlsx 是隱藏檔案,並且可以透過檔案屬性 –a-h— 來識別。您也可以將此引數與 –Recurse 或 –Depth 結合使用。Get-ChildItem D:\Temp\ -Recurse -Force

廣告

© . All rights reserved.