Aracılığıyla paylaş


Liste Görünümü (Etiketler)

Bu örnek, listenin her satırı için özel etiket görüntüleyen bir liste görünümünün nasıl uygulandığını gösterir. Bu liste görünümü, Get-Service cmdlet'i tarafından döndürülen System.ServiceProcess.ServiceController nesnesinin özelliklerini görüntüler. Liste görünümünün bileşenleri hakkında daha fazla bilgi için bkz. Liste Görünümü Oluşturma.

Bu biçimlendirme dosyasını yükle

  1. Bu konunun Örnek bölümündeki XML'yi bir metin dosyasına kopyalayın.

  2. Metin dosyasını kaydedin. Biçimlendirme dosyası olarak tanımlamak için dosyaya format.ps1xml uzantısını eklediğinizden emin olun.

  3. Windows PowerShell'i açın ve biçimlendirme dosyasını geçerli oturuma yüklemek için aşağıdaki komutu çalıştırın: Update-FormatData -PrependPath PathToFormattingFile.

Uyarı

Bu biçimlendirme dosyası, Windows PowerShell biçimlendirme dosyası tarafından zaten tanımlanmış bir nesnenin görünümünü tanımlar. cmdlet'ini çalıştırırken PrependPath parametresini kullanmanız gerekir ve bu biçimlendirme dosyasını modül olarak yükleyemezsiniz.

Gösterir

Bu biçimlendirme dosyası aşağıdaki XML öğelerini gösterir:

Örnek

Aşağıdaki XML, her satırda özel bir etiket görüntüleyen bir liste görünümünü tanımlar. Bu durumda etiket, her harfi büyük harfle birlikte özellik adını ve "property" sözcüğünü içerir. Her satırda, özelliğin adı ve ardından özelliğin değeri görüntülenir.

<Configuration>
  <ViewDefinitions>
    <View>
  <Name>System.ServiceProcess.ServiceController</Name>
  <ViewSelectedBy>
    <TypeName>System.ServiceProcess.ServiceController</TypeName>
  </ViewSelectedBy>
  <ListControl>
    <ListEntries>
      <ListEntry>
        <ListItems>
          <ListItem>
            <Label>NAME property</Label>
            <PropertyName>Name</PropertyName>
          </ListItem>
          <ListItem>
            <Label>DISPLAYNAME property</Label>
            <PropertyName>DisplayName</PropertyName>
          </ListItem>
          <ListItem>
            <Label>STATUS property</Label>
            <PropertyName>Status</PropertyName>
          </ListItem>
          <ListItem>
            <Label>SERVICETYPE property</Label>
            <PropertyName>ServiceType</PropertyName>
          </ListItem>
        </ListItems>
      </ListEntry>
    </ListEntries>
  </ListControl>
</View>

  </ViewDefinitions>
</Configuration>

Aşağıdaki örnekte, Windows PowerShell'in bu biçim dosyası yüklendikten sonra System.ServiceProcess.ServiceController nesnelerini nasıl görüntülediği gösterilmektedir.

Get-Service f*
NAME property        : Fax
DISPLAYNAME property : Fax
STATUS property      : Stopped
SERVICETYPE property : Win32OwnProcess

NAME property        : FCSAM
DISPLAYNAME property : Microsoft Antimalware Service
STATUS property      : Running
SERVICETYPE property : Win32OwnProcess

NAME property        : fdPHost
DISPLAYNAME property : Function Discovery Provider Host
STATUS property      : Stopped
SERVICETYPE property : Win32ShareProcess

NAME property        : FDResPub
DISPLAYNAME property : Function Discovery Resource Publication
STATUS property      : Running
SERVICETYPE property : Win32ShareProcess

NAME property        : FontCache
DISPLAYNAME property : Windows Font Cache Service
STATUS property      : Running
SERVICETYPE property : Win32ShareProcess

NAME property        : FontCache3.0.0.0
DISPLAYNAME property : Windows Presentation Foundation Font Cache 3.0.0.0
STATUS property      : Stopped
SERVICETYPE property : Win32OwnProcess

NAME property        : FSysAgent
DISPLAYNAME property : Microsoft Forefront System Agent
STATUS property      : Running
SERVICETYPE property : Win32OwnProcess

NAME property        : FwcAgent
DISPLAYNAME property : Firewall Client Agent
STATUS property      : Running
SERVICETYPE property : Win32OwnProcess

Ayrıca Bkz.

Biçimlendirme Dosyaları Örnekleri

PowerShell Biçimlendirme Dosyasını Yazma