From 96daf4f5ae9cbd7d095409e0588f916065cafc9d Mon Sep 17 00:00:00 2001 From: Isaac Shoebottom Date: Thu, 26 Oct 2023 11:15:34 -0300 Subject: [PATCH] Download temp file in temp folder --- SteamToggleUpdate/ToggleCyberpunkUpdates.ps1 | 10 +++++++--- SteamToggleUpdate/ToggleSkyrimUpdates.ps1 | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/SteamToggleUpdate/ToggleCyberpunkUpdates.ps1 b/SteamToggleUpdate/ToggleCyberpunkUpdates.ps1 index 3d3e10a..5aff926 100644 --- a/SteamToggleUpdate/ToggleCyberpunkUpdates.ps1 +++ b/SteamToggleUpdate/ToggleCyberpunkUpdates.ps1 @@ -6,11 +6,15 @@ If (Test-Path -Path ".\ToggleUpdates.ps1" -PathType Leaf) { .\ToggleUpdates.ps1 $appId } Else { + # construct temp path + $env:temp = [System.IO.Path]::GetTempPath() + $tempPath = $env:temp + "\ToggleUpdates.ps1" + # Download the network script $wc = New-Object System.Net.WebClient - $wc.DownloadFile($networkLocation, ".\ToggleUpdates.ps1") + $wc.DownloadFile($networkLocation, $tempPath) # Invoke the network script - .\ToggleUpdates.ps1 $appId + &$tempPath $appId # Delete the network script - Remove-Item -Path ".\ToggleUpdates.ps1" + Remove-Item -Path $tempPath } \ No newline at end of file diff --git a/SteamToggleUpdate/ToggleSkyrimUpdates.ps1 b/SteamToggleUpdate/ToggleSkyrimUpdates.ps1 index 0c2980c..4f70c38 100644 --- a/SteamToggleUpdate/ToggleSkyrimUpdates.ps1 +++ b/SteamToggleUpdate/ToggleSkyrimUpdates.ps1 @@ -6,11 +6,15 @@ If (Test-Path -Path ".\ToggleUpdates.ps1" -PathType Leaf) { .\ToggleUpdates.ps1 $appId } Else { + # construct temp path + $env:temp = [System.IO.Path]::GetTempPath() + $tempPath = $env:temp + "\ToggleUpdates.ps1" + # Download the network script $wc = New-Object System.Net.WebClient - $wc.DownloadFile($networkLocation, ".\ToggleUpdates.ps1") + $wc.DownloadFile($networkLocation, $tempPath) # Invoke the network script - .\ToggleUpdates.ps1 $appId + &$tempPath $appId # Delete the network script - Remove-Item -Path ".\ToggleUpdates.ps1" + Remove-Item -Path $tempPath } \ No newline at end of file