2

This is the command:

 netsh wlan start hostednetwork runas /noprofile /user:mymachine\\administrator

I used ranas to prevent the administrator privilege, but it won't.

enter image description here

But when I manually run the command prompt as an administrator and write netsh wlan start hostednetwork it will execute the command.

enter image description here


I am sending this command from Java program, I can't run the command prompt as an administrator then write this command, It should be in one line command that do all works.

Any solution?

Caffe Latte
  • 1,693
  • 1
  • 14
  • 32

1 Answers1

1

I believe what you are looking for is:

runas /noprofile /user:mymachine\administrator "netsh wlan start hostednetwork"

you just got the order of your commands switched on accident.

toro2k
  • 19,020
  • 7
  • 64
  • 71
  • I tried this, it give me this message `Enter the password for mymachine\\administrator:`, and just `ENTER` key works, I can't not type any password. – Caffe Latte Aug 02 '13 at 11:40
  • type in the password for that account and press `ENTER`. It doesn't show the password as you type it. Also there was an extra slash in there. you want `mymachine\administrator` not `mymachine\\administrator`. I didn't notice that when i copied your code, but the answer above has been updated. – HypervisorX Aug 02 '13 at 11:46