From 6a99be9e05108e3b6b7af4ace7c4cfa119dddfa5 Mon Sep 17 00:00:00 2001 From: MyDrift Date: Thu, 29 Aug 2024 00:02:00 +0200 Subject: [PATCH] Improve Transcript (#2620) * improve log logics * spelling fix * change date format --- functions/private/Update-WinUtilProgramWinget.ps1 | 2 +- scripts/start.ps1 | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/functions/private/Update-WinUtilProgramWinget.ps1 b/functions/private/Update-WinUtilProgramWinget.ps1 index 0784657d..7f50d35e 100644 --- a/functions/private/Update-WinUtilProgramWinget.ps1 +++ b/functions/private/Update-WinUtilProgramWinget.ps1 @@ -11,7 +11,7 @@ Function Update-WinUtilProgramWinget { $host.ui.RawUI.WindowTitle = """Winget Install""" - Start-Transcript $ENV:TEMP\winget-update.log -Append + Start-Transcript "$logdir\winget-update_$dateTime.log" -Append winget upgrade --all --accept-source-agreements --accept-package-agreements --scope=machine --silent } diff --git a/scripts/start.ps1 b/scripts/start.ps1 index 06e53b69..0d070cd0 100644 --- a/scripts/start.ps1 +++ b/scripts/start.ps1 @@ -27,11 +27,11 @@ if ($Run) { $PARAM_RUN = $true } -if (!(Test-Path -Path $ENV:TEMP)) { - New-Item -ItemType Directory -Force -Path $ENV:TEMP -} +$dateTime = Get-Date -Format "yyyy-MM-dd_HH-mm-ss" -Start-Transcript $ENV:TEMP\Winutil.log -Append +$logdir = "$env:localappdata\winutil\logs" +[System.IO.Directory]::CreateDirectory("$logdir") +Start-Transcript -Path "$logdir\winutil_$dateTime.log" -Append # Load DLLs Add-Type -AssemblyName PresentationFramework