I am creating a hotspot software for which I need to run a batch file as administrator from a java program. The batch file contains the following two commands:
netsh wlan set hostednetwork mode=allow ssid=name key=password
netsh wlan start hostednetwork
name and password are taken as input from the user.
As capturesteve has written - run the app as administrator. You can use for example cmd.exe
under Windows. If you run the cmd.exe with administrator privileges, everything what will be started from this "administrator" cmd.exe will inherit the rights of his owner. It's a universal principle in Windows (and not only in Windows).
Run the cmd.exe as administrator and start the java app from it:
https://technet.microsoft.com/en-us/library/cc947813%28v=ws.10%29.aspx http://www.softwareok.com/?seite=faq-Windows-8&faq=7
+