dcsimg

Is it possible for an Java application that running on the Windows NT workstation to get the computer name and the user name of the machine it is running on?

Naveed Azhar

I think you can do it using the following approach:
1- Make a batch ( lets say GETWINDIR.BAT ) with the contents :

echo %COMPUTERNAME% > windlocation.txt 
echo %USERNAME% > windlocation.txt 
2- Run this file using Runtime.exec("GETWINDIR.BAT") function from your java program.
3- Use Standard file classes to get the contents of "windlocation.txt"
0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact
×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.