• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

run windows command line statement from java

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
i wanted to build a simple java desktop app where on button click event, some lines of code execute in windows Command Prompt and display the output in a textbox.
I have to run commands as below in administrative privilage and display the output message in a textbox.

netsh wlan set hostednetwork mode=allow ssid=NAME key=PASSWORDis@HARDTOBREAK;
netsh wlan start hostednetwork


I have saved this code in a start.bat file.
i have tried




i have also tried ,,,, but it also doesn't work.


 
Amarjeet Anand
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have tried the code below. It runs correctly and gives output also.


But command doesn't execute and noting comes to output when i change the command from dir to netsh wlan show hostednetwork because this command requires administrative privilage.
 
Marshal
Posts: 79177
377
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don&aps;t even think of using processes until ylu have read the classic article which you can find by searching When Runtime.exec won't by Michael Daconta.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic