Another option would be to give rights to your user to execute or write at the resource you are looking for. If you can, please give more details on want you want to achieve.
Endoro - it's not a dup - he is asking how to do it non-interactively - the answer in the other does it interactively. Thanks for the reply guys. I used UAC control of windows to disable the authentication so that i can run Batch files from batch files. Does this answer your question? How to code a BAT file to always run as admin mode?
Add a comment. Active Oldest Votes. Improve this answer. MrSmile 1, 1 1 gold badge 10 10 silver badges 20 20 bronze badges. Hossein Jafarinejad Hossein Jafarinejad 4 4 silver badges 7 7 bronze badges. On Windows 7: Create a shortcut to that batch file Right click on that shortcut file and choose Properties Click the Advanced button to find a checkbox for running as administrator Check the screenshot below.
Bad answer. OP asked for a way to run the batch file as admin from within another batch file , this doesn't work that way. I probably should've specified that I tried this on XP a while back, it didn't work. I haven't tried it recently so I may be wrong, or I may have done it incorrectly when I did.
That will allow the user to run arbitrary commands with administrative privileges, so you could just as well make him a member of the local administrators group. AnsgarWiechers - in his own words, I am searching for an alternative for running a batch file by right clicking on it and running as an administrator. Another thing is that this cannot be used without administrator password. True, but irrelevant. If you remove the password-prompt you effectively remove the barrier between admin and normal user.
A better approach might be creating a scheduled task. In Linux, if he has root password, he can modify the sudoers file to remove any restriction on sudo. AFAIK, runas. I have tried the following items installAdmin Func installAdmin ; Change the username and password to the appropriate values for your system. Then I found and tried this. CreateObject "WScript.
Shell" WshShell. Run "runas. Sleep WshShell. Thanks so much for any assistance!!! Link to post Share on other sites. Jos 2, Posted January 8, Moved to the appropriate forum, as the Developer General Discussion forum very clearly states: Quote. Moderation Team. Nine 1, Posted January 8, Not much of a signature but working on it Posted January 8, edited. Dana 32 Posted January 8, Why are you using a function for a few simple lines of code? Once I extract the ZIP file to a user PC that does not have admin rights and I run the script created about I get an error "Batch file has not run, the system cannot find the file specified" When I click ok on that it then runs the file, but then I get an alert that I do not have the proper permissions and I need to run the file as "Run as Administrator" So really, the script didn't do anything I was hoping for.
Did I just go about this the wrong way? Put RequireAdmin as the very first line of the script. Thank you so much, again, for all of your help. Hang on I see the problem. Create an account or sign in to comment You need to be a member in order to leave a comment Create an account Sign up for a new account in our community.
Register a new account. Sign in Already have an account? Sign In Now. Followers 0. So if i use RunAS as below I should solve my problem? Earthshine Posted January 13, Posted January 13, They should be running in VM. Juvigy 50 Posted January 15, Posted January 15, Posted January 16, Doing it any other way is just going to be a huge disaster waiting to happen. Earthshine and Draygoes Like Loading Earthshine Posted January 16, Posted January 16, edited.
Draygoes Like Loading Posted March 13, edited. Create an account or sign in to comment You need to be a member in order to leave a comment Create an account Sign up for a new account in our community. Register a new account. Sign in Already have an account? Sign In Now. Followers 0. Go to topic listing.
Recently Browsing 0 members No registered users viewing this page. Sign In Sign Up.
0コメント