From ae0d018e0ac7e1f2bdbcffc2b3eb245228712c83 Mon Sep 17 00:00:00 2001 From: Space Time Date: Fri, 6 Sep 2024 11:18:05 +0800 Subject: [PATCH] =?UTF-8?q?1.1.1.3=20=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Console-HostChecker.ps1 | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/Console-HostChecker.ps1 b/Console-HostChecker.ps1 index 5899868..60d264c 100644 --- a/Console-HostChecker.ps1 +++ b/Console-HostChecker.ps1 @@ -1,17 +1,21 @@ -param ([switch] $trans) +param ([switch] $trans, [switch] $loop) -if ($trans) { Start-Transcript (Join-Path $PSScriptRoot "Trans.log") -UseMinimalHeader | Out-Null } +do { + if ($trans) { Start-Transcript (Join-Path $PSScriptRoot "Trans.log") -UseMinimalHeader | Out-Null } -if ($PSEdition -ne "Core") { - Write-Host "Console HostChecker 需要在 PowerShell 7.x 环境运行" -} -else { - foreach ($ps1File in Get-ChildItem $PSScriptRoot "*.ps1") { - if ($ps1File.FullName -ne $PSCommandPath) { . $ps1File.FullName } + if ($PSEdition -ne "Core") { + Write-Host "Console HostChecker 需要在 PowerShell 7.x 环境运行" } + else { + foreach ($ps1File in Get-ChildItem $PSScriptRoot "*.ps1") { + if ($ps1File.FullName -ne $PSCommandPath) { . $ps1File.FullName } + } - [App]::new().Main() -} + [App]::new().Main() + } + + if ($trans) { Stop-Transcript } + if ($loop) { Start-Sleep 60 } +} while ($loop) -if ($trans) { Stop-Transcript } -else { Read-Host "按回车键结束" } \ No newline at end of file +Read-Host "按回车键结束" \ No newline at end of file