PowerShell将输出记录到多个位置

时间:2019-04-30 08:43:51

标签: powershell logging

我需要将PowerShell public class PlaceDto { private UUID id; private String name; private String subLocality; private String locality; private String postalCode; private String administrativeArea; private String country; private Double latitude; private Double longitude; private Double rating; private Long reviewCount; private Set<PlaceImage> placeImages = new LinkedHashSet<>(); public PlaceDto(){} public PlaceDto(UUID id, String name, String subLocality, String locality, String postalCode, String administrativeArea, String country, Double latitude, Double longitude, Double rating, Long reviewCount,Set<PlaceImage> placeImages){ this.id =id; this.name =name; this.subLocality = subLocality; this.locality = locality; this.postalCode = postalCode; this.administrativeArea = administrativeArea; this.country = country; this.latitude = latitude; this.longitude =longitude; this.rating = rating; this.reviewCount = reviewCount; this.placeImages=placeImages; } } 的输出写入不同的文件夹。

我能够将输出写入一个位置的文本文件。但是我需要在两个不同的文件夹位置创建文本日志。

            variable_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(object_ptr), &EG(uninitialized_zval));

我正在寻找一种包含Test-Netconnection的方法,以便日志记录应该同时在两个文件夹位置进行。

1 个答案:

答案 0 :(得分:0)

按照@Ansgar的答案,我使用Tee-Object方法解决了这个问题。

Write-Output "Network Test Started: $(Get-Date)" | Tee-Object -file $filePath -Append | Out-File $filePath1 -Append

此方法将日志文件保存在两个不同的位置,并且附加操作正常。