B4J Code Snippet Get UUID with jshell (Windows)

Tested On Windows Only./
Windows 7 - 8 - 8.1 - 10 - 11

B4X:
Sub RunShellCommand


    Private shl As Shell
    Private params As List
    params.Initialize
    params.Add("/c")
    params.Add("WMIC CSProduct Get UUID")
    shl.Initialize("shl","cmd.exe",params)
    shl.WorkingDirectory =  "C:\Windows\system32"

    shl.Run(-1)
  
    Wait For shl_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
    If Success And ExitCode = 0 Then
        Log("Success")
'        Log($" ${StdOut} "$)

        Dim st() As String = Regex.Split(CRLF,StdOut)
        Dim MyUUID As String = st(1)
        Log(MyUUID)

    Else
      
        Log("Error: " & StdErr)
      
    End If
  
End Sub
 
Last edited:

MathiasM

Active Member
Licensed User
Works good, but it's good to know that WMIC is deprecated in windows 10 since update 21H1.
 

behnam_tr

Active Member
Licensed User
Longtime User
Works good, but it's good to know that WMIC is deprecated in windows 10 since update 21H1.
i tested on windows 7-8.1-11 and is ok
Have you tested on Windows 10 21h1 or 21h2?
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
I´ve tested it in 21H2 and it still works.
 

Similar Threads

Top