Accessing Wi-Fi network interface details from Java using netsh
It looks like the solution you posted here was copy-pasted (with some cutting of irrelevant lines) from this SO answer and its original code is quite quick&amp;dirty.

However, here are some observations about it:


This will work only on a Windows system.
Neither InputStreamReader nor BufferedReader are closed, which is a bad practice.
It's not clear how IOException is managed. I suppose that it is rethrown by the wrapping method?
while (true) is a bad pattern for loops. 

A better choice would be:

String line = r.readLine();
while (line != null) {
  // logic
  line = r.readLine();
}

Using line.contains("SSID") seems to be enough to identify the line with the SSID, but it will fail if (accidentally) another line of the process output contains this substring. That should not occur normally, but who ever knows how the parameters are set on the host where it is run? I'd suggest here to split the line in two parts by ':' and check if the trimmed left side equals("SSID").