Draygoes Posted March 28, 2023 Share Posted March 28, 2023 I want to launch a .bat file from an autoit script. But I need it to be executed in an elevated command prompt. Normally you do this by right clicking & "run as admin"(My wording might be off), but my script is launching it. So, does the CMD window launched get the same privileges me, or do I need to use RunAs(ME)? If I have to use RunAs, I need to ask for help at this point because Micro$oft has made using runas mildly confusing. Which account name is it referring to my account nickname, my sign in email address, or the account name as given out by the "WHOAMI" command in cmd? Same question for the Password. Do I just use my Pin, or do I need to use my Microsoft account password? And as always, thank you for your time. Spoiler "If a vegetarian eats vegetables,What the heck does a humanitarian eat?" "I hear voices in my head, but I ignore them and continue on killing." "You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring." An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist. Link to comment Share on other sites More sharing options...
Subz Posted March 28, 2023 Share Posted March 28, 2023 You shouldn't require RunAs when using #RequireAdmin as this will elevate the script, you can test this by running the following, you'll notice that the CMD window is running as Administrator #RequireAdmin Run(@Comspec & " /k Echo Hello") Link to comment Share on other sites More sharing options...
Draygoes Posted March 29, 2023 Author Share Posted March 29, 2023 4 hours ago, Subz said: You shouldn't require RunAs when using #RequireAdmin as this will elevate the script, you can test this by running the following, you'll notice that the CMD window is running as Administrator #RequireAdmin Run(@Comspec & " /k Echo Hello") Thanks. That was exactly the answer I was looking for. You rock @Subz(Also, big fan of SubZero) Spoiler "If a vegetarian eats vegetables,What the heck does a humanitarian eat?" "I hear voices in my head, but I ignore them and continue on killing." "You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring." An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist. Link to comment Share on other sites More sharing options...
Recommended Posts
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. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now