05-06-2023, 09:41 PM
(05-06-2023, 01:48 AM)JRace Wrote: Try piping the output through MORE, which will output plain old text:
Code: (Select All)'JSR sez: changed returncode to _UNSIGNED _INTEGER64, added line to print it & dump it to a file.
'When compiled with QB64PE 32-bit, returncode~&& is different every time I run this program (typically 106AC990000ACBC, but the first 4 hex digits are different each time).
'When compiled with QB64PE 64-bit, returncode~&& is ACBC. Still a mystery.
'Haven't had much luck decoding that return code on Google just yet.
returncode~&& = Shell("wmic cpu get NumberOfCores | more >tmp.txt")
Print Hex$(returncode~&&)
o$ = "echo " + Hex$(returncode~&&) + ">TestForTheSolarCode_returncode.txt"
Shell (o$)
If _FileExists("tmp.txt") Then
Open "tmp.txt" For Input As #1
Do Until EOF(1)
Line Input #1, a$
Print ">"; a$; "<"; filecount%; ",len="; Len(a$)
filecount% = filecount% + 1
Loop
Close #1
Else
Print "tmp.txt not found"
End If
'KILL "tmp.txt"
FWIW: I had to run the WMIC command on the command line to test it. Trying it with the QB64PE (32-bit, hmm) Shell function on my Win7 Pro 64-bit system returns a code and fails to create tmp.txt.
(Update: OK, I just tested this program on QB64PE-64, and it is failing with a code of ACBC now. No idea what _that_ means.) (This is my final edit... I pinkie-swear.)
FWIW2: https://research.nccgroup.com/2022/03/10...owershell/
Thank you, quite elegant solution.