Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi How to run cmd as admin rigths form ASP.NET in vb codings ? or
How to set cmd always run as admin rights when run batch file in win8 and win7.


Note: i don't want like.right click cmd form all programs and click "Run as ADministration"
if i type cmd form run command always open like "C:\Windows\system32>" not like "C:\Users\Admin-PC>"
Because i will call batch file form asp.net,that batch file need to execute in cmd admin rights,otherwise it not work.In that batch file i am right "shutdown \r \f \t10" i.e i will restart the machine.

Manully i not open cmd,using asp.net i will call process and use cmd to run,For example above i mention like need open in C:\Windows\system32


Regards
Aravind
Posted
Comments
Sergey Alexandrovich Kryukov 26-Jul-14 16:20pm    
It looks like you want to reboot the host running an HTTP server, by request of a Web user. How can it possibly make any sense?
—SA
Aravindba 26-Jul-14 22:24pm    
ok u can take it like this,i need to get ip config ,so in that batch file i will write get ip config code,so how to run batch file
Sergey Alexandrovich Kryukov 26-Jul-14 22:28pm    
By
System.Diagnostic.Process.Start(batchFileName, commandLine);
—SA
Aravindba 26-Jul-14 22:36pm    
can u explain argument what u pass ? for batch file name need to give batch file name or path of batch file with file name and command line what need to give,bcz cmd line already write in batch file,then why again need to give in argument ?

1 solution

Try this:
Sign in with root authority.

Good luck!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900