Using wmic to get info
-
I'm making a QT application to retrieve info from OS.I'm trying to access wmic.exe directly ( i added the path Windows\System32\wbem\ previously in the code ) and i don't want to use it through cmd.The code works fine in Windows Vista/7 but doesnt work in Windows XP
Sample code :
@ QProcess process;
process.start(QString("wmic bios get serialnumber"));
process.waitForStarted();
process.waitForFinished();
qDebug()<<process.readAll();
system("pause");@Note : I'm using QT 4.6
Any Ideas ?
-
Hi and welcome to devnet,
Are you sure the command is available on XP and at the same place ?
-
Did you read the standard out/error channels of QProcess ?
-
Did you check whether waitForStarted and waitForFinished returns true ?
-
What's the exit code ?
-
Solved same problem a year ago.
This is part of working function from my app:@...
QString Arguments = "/node:" + IP + " " + Args + " get /format:list";
...
Process.setProcessChannelMode (QProcess::MergedChannels);
Process.start ("wmic");
Process.waitForStarted ();
Process.write (Arguments.toUtf8 ());
Process.closeWriteChannel();while (Process.waitForReadyRead ())
{
while (Process.canReadLine())
{
...@