我想创建一个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