Skip to content

Commit 6a7e5d3

Browse files
committed
fix(win): replace deprecated WMIC by powershell command
Fixes #109 Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent 2976abd commit 6a7e5d3

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

win/massStorageCopy.bat

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,9 @@ goto :eof
3232

3333
:sub
3434
setlocal enabledelayedexpansion
35-
for /F "skip=1 tokens=*" %%a in ('WMIC LOGICALDISK where "volumename like '%~1'" get deviceid 2^>NUL') do if not defined id set id=%%a
36-
call set "deviceid=%%id: =%%"
37-
if not "%deviceid%" == "" (
38-
%~dp0busybox.exe cp -f %SRC_PARSE% %deviceid%
39-
if !errorlevel! == 0 (echo Upload complete on %1 ^(%deviceid%^))
35+
for /F "delims=" %%a in ('powershell -nologo -command ^
36+
"Get-CimInstance -ClassName 'Win32_LogicalDisk' -Filter 'DriveType = 2' | Where-Object { $_.VolumeName -eq '%~1' } | Select-Object -ExpandProperty DeviceID" 2^>NUL') do if not "%%a" == "" (
37+
%~dp0busybox.exe cp -f %SRC_PARSE% %%a
38+
if !errorlevel! == 0 (echo Upload complete on %1 ^(%%a^))
4039
exit !errorlevel!)
4140
goto :eof

0 commit comments

Comments
 (0)