我想創建一個PowerShell腳本,它將獲得計劃任務的列表。我已經足夠得到一個完整的任務列表,但我需要刪除尾隨「...」PowerShell:刪除尾隨「...」
你是如何做到這一點?
$tasks | Select-String -pattern "Disabled" | ft @{Expression
={$_.Line};Label="Line";width=44}
輸出:
Line
----
AD RMS Rights Policy Template Management ...
AD RMS Rights Policy Template Management ...
Proxy ...
UserTask ...
UserTask-Roam ...
Consolidator ...
KernelCeipTask ...
UsbCeip ...
ScheduledDefrag ...
Scheduled ...
Microsoft-Windows-DiskDiagnosticDataColl ...
Microsoft-Windows-DiskDiagnosticResolver ...
Notifications ...
WinSAT ...
ActivateWindowsSearch ...
ConfigureInternetTimeService ...
DispatchRecoveryTasks ...
ehDRMInit ...
InstallPlayReady ...
mcupdate ...
MediaCenterRecoveryTask ...
ObjectStoreRecoveryTask ...
OCURActivate ...
OCURDiscovery ...
PBDADiscovery ...
PBDADiscoveryW1 ...
PBDADiscoveryW2 ...
PeriodicScanRetry ...
PvrRecoveryTask ...
PvrScheduleTask ...
RecordingRestart ...
RegisterSearch ...
ReindexSearchRoot ...
SqlLiteRecoveryTask ...
UpdateRecordPath ...
CorruptionDetector ...
DecompressionFailureDetector ...
HotStart ...
LPRemove ...
SystemSoundsService ...
GatherNetworkInfo ...
Background Synchronization ...
Logon Synchronization ...
AnalyzeSystem ...
RacTask ...
RegIdleBackup ...
WindowsParentalControls ...
WindowsParentalControlsMigration ...
AutoWake ...
GadgetManager ...
SessionAgent ...
SystemDataProviders ...
SR ...
Interactive ...
IpAddressConflict1 ...
IpAddressConflict2 ...
MsCtfMonitor ...
SynchronizeTime ...
ResolutionHost ...
QueueReporting ...
BfeOnServiceStartTypeChange ...
UpdateLibrary ...
ConfigNotification ...
Calibration Loader ...
這是回答:但不能提交; $ tasks |選擇字符串模式「禁用」| ForEach-Object {$ _ -replace「Disabled」,「」}} | ForEach-Object {$ _ -replace「Could not start」, 「」} | ForEach-Object {$ _。Trim()} – nals 2011-05-31 20:26:31