From 3ccff07c2798433292c1585a1d9a99fd7195d3b7 Mon Sep 17 00:00:00 2001 From: Romanitho <96626929+Romanitho@users.noreply.github.com> Date: Tue, 18 Jan 2022 14:13:29 +0100 Subject: [PATCH] Add dynamic variable location Change script execution location for dynamic variable --- winget-update/winget-notify.ps1 | 2 +- winget-update/winget-upgrade.ps1 | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/winget-update/winget-notify.ps1 b/winget-update/winget-notify.ps1 index d8053d2..7c98651 100644 --- a/winget-update/winget-notify.ps1 +++ b/winget-update/winget-notify.ps1 @@ -1,7 +1,7 @@ #Send Notif Script #get xml notif config -[xml]$NotifConf = Get-Content "C:\ProgramData\winget-update\notif.xml" -Encoding UTF8 +[xml]$NotifConf = Get-Content "$PSScriptRoot\notif.xml" -Encoding UTF8 if (!($NotifConf)) {break} #Load Assemblies diff --git a/winget-update/winget-upgrade.ps1 b/winget-update/winget-upgrade.ps1 index b6c6870..ed16a94 100644 --- a/winget-update/winget-upgrade.ps1 +++ b/winget-update/winget-upgrade.ps1 @@ -1,6 +1,6 @@ function Init { #Var - $Script:WorkingDir = "C:\ProgramData\winget-update" + $Script:WorkingDir = $PSScriptRoot #Logs initialisation $LogPath = "$WorkingDir\logs" @@ -277,4 +277,4 @@ else{ $Balise = "connection" Run-NotifTask $Title $Message $MessageType $Balise } -Write-Log "End of process!" "Cyan" +Write-Log "End of process!" "Cyan" \ No newline at end of file