I was writing a simple batch file with the following command
net user Abhi *
where Abhi is my username and I am the administrator of my computer. On execution, it prompts for a password and then exits with Access is denied
error. I know it requires administrator privileges, but don't know how to do it.
I tried it using:
runas administrator net user abhi *
But it did not work.
How do I run this command successfully (as admin)?
Runas
is a single word.C:\runas /user:username\administrator cmd
after this it will ask for password if you have set any type it and if it gives the error then you can try only hitEnter
when it prompt for password. Then you can runnet user ABhi*
.