Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting System32 folder location with java

Tags:

java

system32

On XP and above, my System32 folder is at C:\WINDOWS\system32. On Windows 2000 it is at C:\WINNT\system32. Is there a

System.getProperty("something");
or some way that I can get the location of the System32 folder?
like image 870
user489041 Avatar asked Dec 02 '10 19:12

user489041


1 Answers

Since I think NT, the way to get it through environment variables is: %WINDIR%\system32

You can do this:

String sysdir = System.getenv("WINDIR") + "\\system32";

More default environment variables for windows on Wikipedia: http://en.wikipedia.org/wiki/Environment_variable#Examples_from_Microsoft_Windows

SYSTEMROOT and WINDIR are identical in NT systems, but WINDIR also works for older, 9x kernel-based windows.

like image 167
逆さま Avatar answered Sep 19 '22 08:09

逆さま