From 95fe54df0a9a8228ad104ed66b1531216a971e12 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Mar 2026 10:17:52 +0000 Subject: [PATCH 1/3] Initial plan From 484e3f54ada799c65f2275fa19b3b53110cd614c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Mar 2026 10:21:50 +0000 Subject: [PATCH 2/3] fix: fallback to PowerShell Get-CimInstance when wmic not available on Windows 11 Co-authored-by: jamesmarkchan <6020424+jamesmarkchan@users.noreply.github.com> --- src/jdiskmark/UtilOs.java | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/jdiskmark/UtilOs.java b/src/jdiskmark/UtilOs.java index 02eea41..340727a 100644 --- a/src/jdiskmark/UtilOs.java +++ b/src/jdiskmark/UtilOs.java @@ -775,12 +775,41 @@ public static String getProcessorNameWindows() { LOGGER.log(Level.SEVERE, "Failed to get processor name. Exit code: {0}", exitCode); } - } catch (IOException | InterruptedException e) { + } catch (IOException e) { + // wmic may not be available on newer Windows versions (e.g. Windows 11) + LOGGER.log(Level.WARNING, "wmic not available, falling back to PowerShell: {0}", e.getMessage()); + return getProcessorNameWindowsPowerShell(); + } catch (InterruptedException e) { LOGGER.log(Level.SEVERE, null, e); } return ""; // Return an empty string if no processor name was found } + + static String getProcessorNameWindowsPowerShell() { + try { + ProcessBuilder pb = new ProcessBuilder( + "powershell.exe", "-Command", + "Get-CimInstance -Class Win32_Processor | Select-Object -ExpandProperty Name"); + Process process = pb.start(); + try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()))) { + String line; + while ((line = reader.readLine()) != null) { + if (!line.trim().isEmpty()) { + return line.trim(); + } + } + } + int exitCode = process.waitFor(); + if (exitCode != 0) { + LOGGER.log(Level.SEVERE, + "Failed to get processor name via PowerShell. Exit code: {0}", exitCode); + } + } catch (IOException | InterruptedException e) { + LOGGER.log(Level.SEVERE, null, e); + } + return ""; + } public static String getProcessorNameMacOS() { try { From 6ca688f7599d7697be6f47e9ac9a2011fc3abd59 Mon Sep 17 00:00:00 2001 From: James Mark Chan Date: Fri, 6 Mar 2026 14:54:33 -0800 Subject: [PATCH 3/3] #146 change msg to info --- src/jdiskmark/UtilOs.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jdiskmark/UtilOs.java b/src/jdiskmark/UtilOs.java index 340727a..823584f 100644 --- a/src/jdiskmark/UtilOs.java +++ b/src/jdiskmark/UtilOs.java @@ -777,7 +777,7 @@ public static String getProcessorNameWindows() { } } catch (IOException e) { // wmic may not be available on newer Windows versions (e.g. Windows 11) - LOGGER.log(Level.WARNING, "wmic not available, falling back to PowerShell: {0}", e.getMessage()); + LOGGER.log(Level.INFO, "wmic not available, falling back to PowerShell: {0}", e.getMessage()); return getProcessorNameWindowsPowerShell(); } catch (InterruptedException e) { LOGGER.log(Level.SEVERE, null, e);