@@ -21,6 +21,8 @@ function Invoke-MicrowinGetIso {
2121 Write-Host " / /\/\ \| || (__ | | | (_) | \ /\ / | || | | | "
2222 Write-Host " \/ \/|_| \___||_| \___/ \/ \/ |_||_| |_| "
2323
24+ $tempDir = [IO.Path ]::GetTempPath().TrimEnd(" \" )
25+
2426 if ($sync [" ISOmanual" ].IsChecked) {
2527 # Open file dialog to let user choose the ISO file
2628 Invoke-MicrowinBusyInfo - action " wip" - message " Please select an ISO file..." - interactive $true
@@ -64,7 +66,7 @@ function Invoke-MicrowinGetIso {
6466 Invoke-MicrowinBusyInfo - action " wip" - message " Downloading Fido script..." - interactive $false
6567 Invoke-WebRequest " https://github.com/pbatard/Fido/raw/master/Fido.ps1" - OutFile $fidopath
6668
67- Set-Location - Path $ env: temp
69+ Set-Location - Path " $tempDir "
6870 # Detect if the first option ("System language") has been selected and get a Fido-approved language from the current culture
6971 $lang = if ($sync [" ISOLanguage" ].SelectedIndex -eq 0 ) {
7072 Microwin- GetLangFromCulture - langName (Get-Culture ).Name
@@ -84,7 +86,7 @@ function Invoke-MicrowinGetIso {
8486 [System.Windows.MessageBox ]::Show($msg , " Winutil" , [System.Windows.MessageBoxButton ]::OK, [System.Windows.MessageBoxImage ]::Error)
8587 return
8688 }
87- Set-Location $originalLocation
89+ Set-Location " $originalLocation "
8890 # Use the FullName property to only grab the file names. Using this property is necessary as, without it, you're passing the usual output of Get-ChildItem
8991 # to the variable, and let's be honest, that does NOT exist in the file system
9092 $filePath = (Get-ChildItem - Path " $env: temp " - Filter " Win11*.iso" ).FullName | Sort-Object LastWriteTime - Descending | Select-Object - First 1
@@ -128,7 +130,7 @@ function Invoke-MicrowinGetIso {
128130 $expectedADKPath = " $ ( $adkKitsRoot ) Assessment and Deployment Kit"
129131 $expectedADKPath_WOW64Environ = " $ ( $adkKitsRoot_WOW64Environ ) Assessment and Deployment Kit"
130132
131- $oscdimgPath = Join-Path $ env: TEMP ' oscdimg.exe'
133+ $oscdimgPath = " $tempDir \ oscdimg.exe"
132134 $oscdImgFound = [bool ] (Microwin- TestKitsRootPaths - adkKitsRootPath " $expectedADKPath " - adkKitsRootPath_WOW64Environ " $expectedADKPath_WOW64Environ " ) -or (Test-Path $oscdimgPath - PathType Leaf)
133135 Write-Host " oscdimg.exe on system: $oscdImgFound "
134136
@@ -241,8 +243,8 @@ function Invoke-MicrowinGetIso {
241243 $randomMicrowinScratch = " MicrowinScratch_${timestamp} _${randomNumber} "
242244 $sync.BusyText.Text = " - Mounting"
243245 Write-Host " Mounting Iso. Please wait."
244- $mountDir = Join-Path $ env: TEMP $randomMicrowin
245- $scratchDir = Join-Path $ env: TEMP $randomMicrowinScratch
246+ $mountDir = " $tempDir \ $randomMicrowin "
247+ $scratchDir = " $tempDir \ $randomMicrowinScratch "
246248
247249 $sync.MicrowinMountDir.Text = $mountDir
248250 $sync.MicrowinScratchDir.Text = $scratchDir
0 commit comments