Guy_ Posted May 14, 2023 Share Posted May 14, 2023 (edited) After 25 years using Windows, I'm still a n00b re. accounts or Admin mode in Windows. Only since Win 10 am I in a system with "more safety" and potential hassle (is how I look at it). So I wanted to copy/move/delete some files from within my utilities.exe AutoIt program. As some of these files/destinations are in protected folders, the easy solution seemed to run utilities.exe as an Administrator. However, if my program also starts up, say, Photoshop, this too seems to now run in Admin mode, which seems to cause all kinds of hassle, i.e., a cascade of other software I have to put in Admin mode too for them to still recognize each other. The ideal for me would be if my utilities.exe (running as Administrator) would be able to start Photoshop "normally." I have already tried to point to a .bat file starting up Photoshop, but this seems to have the same effect. As an alternative, I would be equally helped if I could run utilities.exe normally, but have a way to make the copy/move functions work for protected folders. I guess I could also simply turn off these folder protections, as I don't care for them (nevertheless still hoping it makes life a little safer). TIA! Edited May 14, 2023 by Guy_ Link to comment Share on other sites More sharing options...
Solution ioa747 Posted May 14, 2023 Solution Share Posted May 14, 2023 (edited) Edit: of course there is also Runs an external program under the context of a different user.RunAs ( "username", "domain", "password", logon_flag, "program" [, "workingdir" [, show_flag [, opt_flag]]] ) Edited May 14, 2023 by ioa747 Guy_ 1 I know that I know nothing Link to comment Share on other sites More sharing options...
Guy_ Posted May 14, 2023 Author Share Posted May 14, 2023 (edited) Thanks! I was there earlier but was overwhelmed by the 137 solutions... Turns out I remembered the shortcut technique wrongly as using a .bat file. The shortcut technique does work. shortcut solution Edited May 14, 2023 by Guy_ Link to comment Share on other sites More sharing options...
ioa747 Posted May 14, 2023 Share Posted May 14, 2023 and it doesn't matter what credentials you're running with in Explorer that runs the shortcut? As soon as you do the test, reply so we can know too I know that I know nothing Link to comment Share on other sites More sharing options...
Guy_ Posted May 14, 2023 Author Share Posted May 14, 2023 (edited) 43 minutes ago, ioa747 said: and it doesn't matter what credentials you're running with in Explorer that runs the shortcut? As soon as you do the test, reply so we can know too I don't even know what "credentials" would mean here? I just have one login password into Windows, AFAIK. I just use this and it works... Run("explorer.exe " & $_Photoshop_shortcut) Edited May 14, 2023 by Guy_ ioa747 1 Link to comment Share on other sites More sharing options...
Guy_ Posted May 14, 2023 Author Share Posted May 14, 2023 Or do you mean to try normally and as Admin? "As Admin" works and I'd say the other option would obviously work too. I do know it doesn't do the files right if I'm not in Admin mode. Link to comment Share on other sites More sharing options...
mistersquirrle Posted May 14, 2023 Share Posted May 14, 2023 I believe that this works because by design explorer.exe cannot run with elevated permissions, so you're now launching the program through a non-elevated process. I'm sure that there is some official documentation on why, but I can't really find it. It's just something that I've seen mentioned. There's no credentials or anything, and you'd get the same thing if you started a different AutoIt program without administration and told it to launch another process. This was one of the suggestions in the linked thread as well, have a script that starts as admin, and one as non-admin, then use some type of IPC or control to tell one of the scripts to launch another program. explorer.exe is just a convenient way to start up something else, and you don't need a shortcut to do it. You can use the full path to the file as well. Guy_ 1 We ought not to misbehave, but we should look as though we could. 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