Start-Transcript
来监控它。 但是记录文件中缺少大部分git
输出。我尝试将
git
输出重定向到Out-Host
和Out-Default
,但都没有效果。以下是我的代码...
$DateTime = Get-Date -Format "yyyyMMdd_HHmmss"
$TranscriptName = "PSTranscript_$DateTime"
Start-Transcript -Path ".\$TranscriptName.txt"
git --bare clone <GIT_REPO_URL> repo | Out-Default
Stop-Transcript
这是我的控制台输出...
Transcript started, output file is .\PSTranscript_20191119_155424.txt
Cloning into 'repo'...
remote: Counting objects: 58975, done.
remote: Compressing objects: 100% (21457/21457), done.
remote: Total 58975 (delta 43348), reused 51727 (delta 37145)
Receiving objects: 100% (58975/58975), 70.46 MiB | 3.95 MiB/s, done.
Resolving deltas: 100% (43348/43348), done.
Checking out files: 100% (3878/3878), done.
Transcript stopped, output file is .\PSTranscript_20191119_155424.txt
以下是会话记录中捕获的内容,注意一些 git
输出缺失。
**********************
Windows PowerShell transcript start
Start time: 20191119155424
Username:
RunAs User:
Configuration Name:
Machine:
Host Application: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Process ID: 20644
PSVersion: 5.1.17134.858
PSEdition: Desktop
PSCompatibleVersions: 1.0, 2.0, 3.0, 4.0, 5.0, 5.1.17134.858
BuildVersion: 10.0.17134.858
CLRVersion: 4.0.30319.42000
WSManStackVersion: 3.0
PSRemotingProtocolVersion: 2.3
SerializationVersion: 1.1.0.1
**********************
Transcript started, output file is .\PSTranscript_20191119_155424.txt
**********************
Windows PowerShell transcript end
End time: 20191119155457
**********************
Out-Default
永远不应该直接从用户代码中调用。 - mklement0