From 5fd9c28bb8ba51aaa7fed4f79a6afadc454a0bd3 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Mon, 29 Jul 2024 01:22:42 +0200 Subject: [PATCH] Improve handling of `wmic` output --- winiso/winpefs/Scripts/Startup.ps1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/winiso/winpefs/Scripts/Startup.ps1 b/winiso/winpefs/Scripts/Startup.ps1 index 7f62013e..18d13d5e 100644 --- a/winiso/winpefs/Scripts/Startup.ps1 +++ b/winiso/winpefs/Scripts/Startup.ps1 @@ -1,3 +1,2 @@ -$drives = & wmic volume get "DriveLetter,Label"; -$env:SETUP_DRIVE = $($($drives | Select-String -Pattern "$env:SETUP_LABEL") -split "\s+")[0]; +$env:SETUP_DRIVE = (ConvertFrom-Csv ((wmic volume where "Label='$env:SETUP_LABEL'" get DriveLetter) | ForEach-Object { "$_".Trim(); })).DriveLetter; Set-Location (Join-Path $env:SETUP_DRIVE $env:LOCAL_PROJECT_PATH)