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?
Created May 7, 2012
Naveed Azhar I think you can do it using the following approach:
1- Make a batch ( lets say GETWINDIR.BAT ) with the contents :
3- Use Standard file classes to get the contents of "windlocation.txt"
1- Make a batch ( lets say GETWINDIR.BAT ) with the contents :
echo %COMPUTERNAME% > windlocation.txt echo %USERNAME% > windlocation.txt2- 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"