Showing posts with label OS detection in CMD. Show all posts
Showing posts with label OS detection in CMD. Show all posts

Monday, February 9, 2015

How to detect OS version in System

/*
 * Os_version.c
 *
 *  Created on: 09.02.2015
 *  Author: Karthikeyan D
 *  This C code will be useful to detect the OS version in System...
 *  It can be adopted in in various application like Installation mode selection, Directory prediction, etc...
 *
 */

# include <stdio.h>
# include <stdlib.h>
int main()
{
    // To execute system command in  C program

    system("systeminfo | findstr /C:\"OS\"");

    printf("\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");

    system(" systeminfo | findstr /B /C:\"OS Name\" /C:\"OS Version\"");

    printf("\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");

    system("systeminfo");

    return 0;
}