regarding run as administrator in windows 7

chakra1974
chakra1974 used Ask the Experts™
on
Respected sir,

   i am trying to enter ip address from command prompt netsh, it is working well too
when i try to put the entire command in batchfile it was prompting me with an error, the "requested operation requires elevation Run as administrator"
 my question was how to invoke direct administrator console so that my batchfile can run smoothly ,in windows 7 operating system

appreciating you if you can help me in this issue

regards
chakra1974
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Try something like this:

runas /user:your.account netsh ...
runas /user:administrator /savecred c:\file.bat

also you can lower down the UAC in control panel.
open control panel
open User Accounts
Click on "Change User Account Control Settings"
drop the bar to "Never Notify"
click Ok....
JohnBusiness Consultant (Owner)
Most Valuable Expert 2012
Expert of the Year 2018

Commented:
>>>   drop the bar to "Never Notify"  

chakra1974 - As I am sure you already know, turning off UAC is not a very good idea, and I recommend you not do that. Use the other approaches instead.

.... Thinkpads_User
OWASP: Forgery and Phishing

Learn the techniques to avoid forgery and phishing attacks and the types of attacks an application or network may face.

Top Expert 2012

Commented:
Think you could also right click the .bat file and choose Properties - select the Compatibility tab and check the Run as Admin option at bottom

Author

Commented:
Respected sir,

   sorry to ask you minor things i will be appreciating you if you can kindly give me example

i am attaching a file that i have created kindly help me to troubleshoot the file at your convinence. i have pasted the code sir, please help me the error i am getting error it was displaying the syntax

regards
chakra1974

runas /user:vittal.account netsh interface ipv4 set address "Local Area Connection" static 192.168.1.100 gateway=192.168.1.200

pause

Author

Commented:
respected sir,

when i right click on my batch file and choose properties under compatibility tab, under privilege level it is ghosted out i am not able to put thick mark

regards
chakra1974
runas /user:vittal.account netsh int ip set address "local area connection" static 192.168.1.100 255.255.255.0 192.168.1.200
Top Expert 2012

Commented:
Yes sorry it appears that option is only available to EXE type files, so BAT files can't use that, my bad...

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial