Jump to content
Tuts 4 You

0xNOP Blog

  • entries
    3
  • comments
    12
  • views
    10,771

[PureBasic] OS Grabber [Snippet]

Sign in to follow this  
0xNOP

1,945 views

Here we go guys! Yet another snippet! :D

I keep digging with WMI and it's interface WMIC, and I find it pretty useful with all the things you can get, this time I've made this little nice snippet code which grabs the OS Name / Version !

Hope you like it and find it useful :D

 

; English Forum: https://forum.tuts4you.com/
; Author: 0xNOP
; Date: 6.April.2016
; OS: Windows
; Output Demo: http://i.imgur.com/u37a35H.png

ProgID = RunProgram("wmic", "os get caption", "", #PB_Program_Open | #PB_Program_Read | #PB_Program_Hide)
Output$ = ""
If ProgID
  While ProgramRunning(ProgID)
    If AvailableProgramOutput(ProgID)
      Output$ + Trim(ReadProgramString(ProgID))
      Output$ = ReplaceString(Output$, "Caption", "")
    EndIf
  Wend
  MessageRequester("OS", Output$)
  CloseProgram(ProgID) ; Close the connection to the program
EndIf

 

+1

Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×