Skip to content

Commit a52b723

Browse files
committed
utils/uf2conv.py: Use powershell instead of wmic
wmic command was removed in Windows 24H2, so it's not available on most systems these days by default. However, powershell is. Signed-off-by: Daniel Schaefer <[email protected]>
1 parent b19ac9a commit a52b723

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

utils/uf2conv.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,14 @@ def to_str(b):
204204
def get_drives():
205205
drives = []
206206
if sys.platform == "win32":
207-
r = subprocess.check_output(["wmic", "PATH", "Win32_LogicalDisk",
208-
"get", "DeviceID,", "VolumeName,",
209-
"FileSystem,", "DriveType"])
210-
for line in to_str(r).split('\n'):
211-
words = re.split(r'\s+', line)
212-
if len(words) >= 3 and words[1] == "2" and words[2] == "FAT":
213-
drives.append(words[0])
207+
r = subprocess.check_output([
208+
"powershell",
209+
"-Command",
210+
'(Get-WmiObject Win32_LogicalDisk -Filter "VolumeName=\'RPI-RP2\'").DeviceID'
211+
])
212+
drive = to_str(r).strip()
213+
if drive:
214+
drives.append(drive)
214215
else:
215216
searchpaths = ["/mnt", "/media"]
216217
if sys.platform == "darwin":

0 commit comments

Comments
 (0)