找到 2042 篇文章 關於 Microsoft 技術
2K+ 次檢視
當向 Get-ChildItem cmdlet 提供專案(檔案)路徑時,它會提取檔案資訊,例如名稱、上次寫入時間、大小等。例如Get-ChildItem -Path D:\Temp\style.css輸出Directory: D:\Temp Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 08-12-2017 10:16 393 style.css命令要獲取檔案的完整屬性,則需要使用 fl *(Format-List *)管道命令。Get-ChildItem -Path D:\Temp\style.css | fl * 輸出PSPath : Microsoft.PowerShell.Core\FileSystem::D:\Temp\style.css ... 閱讀更多
350 次檢視
有一些方法或函式可用於目錄和檔案操作。目錄的方法。TypeName: System.IO.DirectoryInfo Name MemberType ---- ---------- Create Method CreateObjRef Method CreateSubdirectory Method Delete Method EnumerateDirectories Method EnumerateFiles Method EnumerateFileSystemInfos Method Equals Method ... 閱讀更多
3K+ 次檢視
當您將引數 Get-Member(別名 gm)連線起來並過濾出屬性時,將顯示兩個不同的屬性。一個是用於檔案,另一個是用於資料夾。Get-ChildItem 屬性命令Get-ChildItem | gm | where{$_.Membertype -eq "Property"}輸出** 目錄的屬性TypeName: System.IO.DirectoryInfo Name MemberType Definition ---- ---------- ---------- Attributes Property System.IO.FileAttributes Attributes {get;set;} CreationTime Property datetime CreationTime {get;set;} CreationTimeUtc Property datetime CreationTimeUtc {get;set;} Exists Property bool Exists {get;} Extension ... 閱讀更多
3K+ 次檢視
使用 Passthru 引數,PowerShell 會在控制檯中返回輸出。例如,以下 ID 為 12344 的 notepad.exe 程序將被停止,並且使用 Passthru 引數在控制檯中顯示相同的內容。早些時候,僅使用 Stop-Process 時並非如此。PS C:\WINDOWS\system32> Stop-Process -Id 12344 -PassThru Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName ------- ------ ----- ----- ------ -- -- ----------- 227 13 2800 13440 0.19 12344 1 ... 閱讀更多
277 次檢視
要在停止程序或例項之前獲得使用者的同意,請使用 -confirm 引數。示例在以下示例中,我們將使用 –Confirm 引數停止 ID 為 4900 的 notepad.exe 程序。PS C:\WINDOWS\system32> Stop-Process -Id 4900 -Confirm 確認您確定要執行此操作嗎?對目標“記事本 (4900)”執行操作“Stop-Process”。[Y] 是 [A] 全部是 [N] 否 [L] 全部否 [S] 暫停 [?] 幫助(預設值為“Y”):類似地,您可以使用 –Confirm 引數來停止具有名稱的程序。PS C:\WINDOWS\system32> Stop-Process -Name Notepad -Confirm
290 次檢視
要停止程序的特定例項,需要向 Stop-Process cmdlet 提供程序 ID。示例在以下示例中,我們需要停止例項 ID 為 25400 的記事本程序。輸出Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName ------- ------ ----- ----- ------ -- -- ----------- 228 14 3156 13680 0.13 4900 1 notepad 232 14 3196 13752 0.16 25400 1 notepadStop-Process -Id 25400 現在,當執行 Get-Process 命令時,將沒有程序使用 –Id 25400 執行。命令PS C:\WINDOWS\system32> Get-Process -Name notepad輸出Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName ------- ------ ----- ----- ------ -- -- ----------- 227 13 2808 13492 0.14 4900 1 notepad
2K+ 次檢視
要在 PowerShell 中停止所有正在執行的程序例項,請使用 Stop-Process 命令。例如,在以下示例中,我們有兩個正在執行的 notepad.exe 程序例項。命令PS C:\WINDOWS\system32> Get-Process notepad輸出PS C:\WINDOWS\system32> Get-Process notepad Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName ------- ------ ----- ----- ------ -- -- ----------- 228 13 3160 13448 0.14 15564 1 notepad 228 14 3148 13668 0.17 22644 ... 閱讀更多
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP