How to run exec from Java for netsh?
问题 The following works fine when i type it in directly into cmd.exe : netsh wlan connect name="Profile Name" ssid=XXXXXX However when i try to do this from java it does not work, neither does it throw any exception. It is silently ignored: Runtime.getRuntime().exec("cmd netsh wlan connect name=\"Profile Name\" ssid=XXXXX ") ; ` How can i improve the code ? 回答1: First try removing the cmd parameter (you don't need to run this interpreter, just netsh ). Else it may be due to whitespace characters