Page 1 of 2
Capture Comman Prompt without Console Window
Posted: Sun Nov 18, 2018 6:13 am
by Rathinagiri
Friends,
Anybody having simple method to capture the command prompt output? For example the below command gives me the BIOS serial number (This is required for security)
Code: Select all
wmic bios get serialnumber > sno.txt
Re: Capture Comman Prompt without Console Window
Posted: Sun Nov 18, 2018 7:10 am
by andyglezl
Hola Rathi
Tiene que ser por linea de comandos ?
Te serviria de esta forma ?
Pero no he visto lo del BIOS
*----------------------------------------------------
Hello Rathi
It has to be by command line?
Would you serve in this way?
But I have not seen the BIOS
Code: Select all
FUNCTION ParallelPortInfo()
LOCAL obj, oLocator, oWmi, oCollection
LOCAL cInfo := ""
oLocator := win_oleCreateObject( "wbemScripting.SwbemLocator" )
oWmi := oLocator:ConnectServer()
cInfo := PADL( 'Paralell Port:' , 16 ) + " " + "No hay Puerto Paralelo Físico..." + CRLF
oCollection:= oWMI:ExecQuery("Select * from Win32_ParallelPort") // <====================== Win32_Bios ???
For Each obj In oCollection
cInfo += PADL( 'Name:' , 16 ) + " " + obj:Name + CRLF
cInfo += PADL( 'Caption:' , 16 ) + " " + obj:Caption + CRLF
cInfo += PADL( 'Description:', 16 ) + " " + obj:Description + CRLF
// See Properties --------------- http://msdn.microsoft.com/en-us/library/aa394247(v=vs.85).aspx
Next
cInfo += REPLICATE( "_", 77 ) + CRLF
RETURN cInfo
Re: Capture Comman Prompt without Console Window
Posted: Sun Nov 18, 2018 8:13 am
by Rathinagiri
Wow!
Thank you so much for the timely help @andyglezl
Code: Select all
FUNCTION GetBiosSerialNumber()
LOCAL obj, oLocator, oWmi, oCollection
LOCAL cInfo := ""
oLocator := win_oleCreateObject( "wbemScripting.SwbemLocator" )
oWmi := oLocator:ConnectServer()
oCollection:= oWMI:ExecQuery("Select * from Win32_BIOS") // <====================== Win32_Bios ???
For Each obj In oCollection
cInfo := obj:SerialNumber
// See Properties --------------- http://msdn.microsoft.com/en-us/library/aa394247(v=vs.85).aspx
Next
RETURN cInfo
Re: Capture Comman Prompt without Console Window
Posted: Sun Nov 18, 2018 8:24 am
by bpd2000
Another option:
Code: Select all
Function main()
local cStdOut, oplist
hb_processRun( "cmd.exe /C start /b wmic bios get serialnumber",, @cStdOut )
Msginfo( "result:" + cStdOut)
HB_MEMOWRIT("Result.txt", cStdOut)
Return nil
Re: Capture Comman Prompt without Console Window
Posted: Sun Nov 18, 2018 10:03 am
by esgici
Re: Capture Comman Prompt without Console Window
Posted: Sun Nov 18, 2018 11:10 am
by trmpluym
Somebody knows a way to do the same for PowerShell ?
So launch a PowerShell script and capture the resulting output ?
Maybe a C Guru knows how, here a starting point:
https://blogs.msdn.microsoft.com/kebab/ ... ts-from-c/
Re: Capture Comman Prompt without Console Window
Posted: Sun Nov 18, 2018 12:00 pm
by bpd2000
There may be other solution:
Code: Select all
// demo using power shell
Function main()
local cStdOut, oplist
hb_processRun( "powershell.exe -WindowStyle Hidden Get-WmiObject -Class Win32_BIOS ",, @cStdOut )
Msginfo( "result:" + cStdOut)
HB_MEMOWRIT("PS_Result.txt", cStdOut)
Return nil
Re: Capture Comman Prompt without Console Window
Posted: Sun Nov 18, 2018 2:42 pm
by esgici
Re: Capture Comman Prompt without Console Window
Posted: Mon Nov 19, 2018 1:05 pm
by dragancesu
https://www.nextofwindows.com/the-best- ... ws-machine
I need some data for security, I was try Rathi's version and result is OEM, bios serial number is OEM, I don't believe but that's it
Re: Capture Comman Prompt without Console Window
Posted: Mon Nov 19, 2018 1:49 pm
by edk
On some machines I've got "Default string" as Serial number
Code: Select all
SMBIOSBIOSVersion : F8
Manufacturer : American Megatrends Inc.
Name : BIOS Date: 10/30/17 14:30:15 Ver: 05.0000C
SerialNumber : Default string
Version : ALASKA - 1072009