Run program without admin privilege in admin mode Everything

Have a suggestion for "Everything"? Please post it here.
Post Reply
qaqz111
Posts: 2
Joined: Sat Apr 08, 2017 8:58 am

Run program without admin privilege in admin mode Everything

Post by qaqz111 »

Can you please give a option to run programs from within result list as normal user even in admin mode Everything process?

Or just give an option that let user to define a custom command to run, there are many tools can do this, so that users can archive this by calling a custom tool program.
therube
Posts: 4977
Joined: Thu Sep 03, 2009 6:48 pm

Re: Run program without admin privilege in admin mode Everything

Post by therube »

You should use the Everything Service to avoid running Everything "as Admin".
qaqz111
Posts: 2
Joined: Sat Apr 08, 2017 8:58 am

Re: Run program without admin privilege in admin mode Everything

Post by qaqz111 »

The service seems having some problem, the monitoring can not reflect the changes of filesystem instantly.
I've encountered many times that the result list remains no change while filesystem changes(file created, deleted, etc.), even manually refresh(Press F5) can not make result list be updated.
horst.epp
Posts: 1445
Joined: Fri Apr 04, 2014 3:24 pm

Re: Run program without admin privilege in admin mode Everything

Post by horst.epp »

qaqz111 wrote:The service seems having some problem, the monitoring can not reflect the changes of filesystem instantly.
I've encountered many times that the result list remains no change while filesystem changes(file created, deleted, etc.), even manually refresh(Press F5) can not make result list be updated.
The service is not resposible for updating the index, ist only for having the necessary rights.
So let the service running and alos start Everything with Windows start.
This way you will have the actual contents as fast as possible.
cdull
Posts: 3
Joined: Thu Sep 03, 2020 8:13 am

Re: Run program without admin privilege in admin mode Everything

Post by cdull »

I have found that solution for me.

I already have running a AutoHotkey script running as administrator (i start it automatically with windows task scheduler):

_______________

#if WinActive("ahk_exe Everything.exe") ; Everything is active
F7:: ; Hotkey

oldclipboard := ClipboardAll ; Save the (real) clipboard
sleep, 100
sendinput, ^+c
ClipWait, 1
sendinput, #r ; run file
WinWaitActive, ahk_class #32770, , 1 ; 1 second timeout
if ErrorLevel
{
return
}
else
{
sendinput, ^v{enter}
return
}
clipboard := oldclipboard ; Restore old (real) clipboard
return

_______________

The file will open from "run" without admin privileges.
void
Developer
Posts: 16735
Joined: Fri Oct 16, 2009 11:31 pm

Re: Run program without admin privilege in admin mode Everything

Post by void »

To customize how Everything executes an item:
  • In Everything, from the Tools menu, click Options.
  • Click the Context menu tab on the left.
  • Select Open (Files)
  • Change command from:
    $exec("%1")
  • to:
    $exec("myprogram.exe" "%1")
Does this work with your AutoHotKey script? hopefully this will eliminate the need to copy the item to the clipboard.
cdull
Posts: 3
Joined: Thu Sep 03, 2020 8:13 am

Re: Run program without admin privilege in admin mode Everything

Post by cdull »

No, this is not working. I have problems to open it form another AutoHotkey script. You need to do it with the "run" (Win+R)

But i have added a additional script to open it with doublclick instead of F7 as in the first script (i use both)

In the settings you wrote change:

In Everything, from the Tools menu, click Options.
Click the Context menu tab on the left.
Select Open (Files)
from:
$exec("%1")
to:
$exec(C:\Users\username\documents\everything_helper.ahk) ; insert your path of script

This is the code of everything_helper.ahk:

oldclipboard := ClipboardAll ; Save the (real) clipboard
sleep, 100
sendinput, ^+c
ClipWait, 1
sendinput, #r ;run file
WinWaitActive, ahk_class #32770, , 1 ; 1 second timeout
if ErrorLevel
{
msgbox, problem with everything_helper
return
}
else
{
sendinput, ^v{enter}
return
}

clipboard := oldclipboard ; Restore old (real) clipboard
ExitApp
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: Run program without admin privilege in admin mode Everything

Post by NotNull »

Another approach:
  • Download ADD_Unelevate.reg from this thread
  • Search for ADD_Unelevate.reg in your elevated (running as administrator) Everything
  • Double-click the reg-file and accept the dialogs
Now you can SHIFT-right-click your program, choose "Run as unelevated user" and there you go ..


Bonus:
  • Completely exit Everything: right-click the Everything icon in the system tray and choose Exit
  • Open your Everything.ini
  • Search for the line with "custom_verb01=" and change it to custom_verb01=UnElevate
  • Save Everything.ini
  • Satrt Everything again
  • Go to Menu:Tools > Options > General > Keyboard
  • In the Show commands containing box, enter verb
  • Change the keyboard shortcut of File | Custom verb 1 to F7 (global)
  • Press OK button
Now you can start a program unelevated with F7



BUT ...
I would advice you to NOT run Everything as administrator, bu as a regular user:
- Enable Everything Service
- Disable Run as administrator

Both settings can be found under Menu:Tools > Options > General
cdull
Posts: 3
Joined: Thu Sep 03, 2020 8:13 am

Re: Run program without admin privilege in admin mode Everything

Post by cdull »

The solution with AutoHotkey works, but it costs some extra seconds. And it is annoying to see the run dialog popping up at this method.

Because no of all these solutions are satifying, i switched to use everything without administration mode.

I hope that there in the future will be a option (checkbox) within everything to "run files without admin mode".

My main problem with running files in admin mode is that my AutoHotkey hotkeys are not working, because i run AutoHotkey not in admin mode.
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: Run program without admin privilege in admin mode Everything

Post by NotNull »

cdull wrote: Tue Nov 03, 2020 9:25 am i switched to use everything without administration mode.
Good! That is the recommended way to run Everything.
cdull wrote: Tue Nov 03, 2020 9:25 am Because no of all these solutions are satifying,
What was wrong with them?

cdull wrote: Tue Nov 03, 2020 9:25 am My main problem with running files in admin mode is that my AutoHotkey hotkeys are not working, because i run AutoHotkey not in admin mode.
That is a Windows limitation.
raccoon
Posts: 1017
Joined: Thu Oct 18, 2018 1:24 am

Re: Run program without admin privilege in admin mode Everything

Post by raccoon »

Let me toss in that I tend to agree with OP. His particular situations aside, it would be proper for Everything running As Admin to execute files As Not Admin as the default behavior, and offer up a checkbox Execute Files As Admin for both Everything As Admin, and Everything As Service users.

The behavior of how files are executed, elevated or not, should be agnostic to whether Everything is running as admin or as a service. To keep everyone safe. This should not at all be a tricky thing to code.

As a tech who uses Everything on a USB key, I do use Everything as Admin, but don't want to launch things with Admin privs.
raccoon
Posts: 1017
Joined: Thu Oct 18, 2018 1:24 am

Re: Run program without admin privilege in admin mode Everything

Post by raccoon »

On an aside, addendum, I still feel that Everything is doing something wrong when it comes to executing / spawning child processes. They should not be inheriting the Everything process and process priority as they presently do. Other software I use that execute / spawn child processes are capable of launching them externally and not paternally.
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: Run program without admin privilege in admin mode Everything

Post by NotNull »

raccoon wrote: Tue Nov 10, 2020 7:24 pm Let me toss in that I tend to agree with OP. His particular situations aside, it would be proper for Everything running As Admin to execute files As Not Admin as the default behavior, and offer up a checkbox Execute Files As Admin for both Everything As Admin, and Everything As Service users.

The behavior of how files are executed, elevated or not, should be agnostic to whether Everything is running as admin or as a service. To keep everyone safe.
I don't agree with this (at all!)
If you decide to run Everything elevated, programs started from Everything should be run elevated too. In that case I do not want UAC prompts for firewall.cpl and all .msc files (to name an example).
But I would not run Everything elevated, not even from a USB stick. Just like I would not run any file manager elevated (unless for a very specific reason). There are just too many risks ...
This should not at all be a tricky thing to code.As a tech who uses Everything on a USB key, I do use Everything as Admin, but don't want to launch things with Admin privs.
Simply write a wrapper script that installs the service, runs Everything (unelevated!) and removes the service when Everything is no longer running. A couple of lines of code should suffice for that.

No need to code this into Everything (IMO). If you want all your programs to be started unelevated:
  • Go to Menu:Tools > Options > General > Context Menu
  • Select Open (Files)
  • Replace $exec("%1") with $exec(explorer.exe "%1")
  • Click the OK button
  • Done
That works because now your programs will be executed by Explorer.exe. And Explorer can't run elevated (was possible on WinXP but no longer after that), so the program will be executed using the credentials of the logged on user.
(That is how the reg-file works that I posted earlier in this thread)
raccoon
Posts: 1017
Joined: Thu Oct 18, 2018 1:24 am

Re: Run program without admin privilege in admin mode Everything

Post by raccoon »

What if you launch a different program from the file's right-click context menu? Is that also influenced by this? Such as `Edit with Notepad++`
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: Run program without admin privilege in admin mode Everything

Post by NotNull »

raccoon wrote: Wed Nov 11, 2020 9:00 am What if you launch a different program from the file's right-click context menu? Is that also influenced by this? Such as `Edit with Notepad++`
No, that will run elevated (not tested though).
That is another reason to run as 'normal' restricted user: the context-menu might differ between accounts.
raccoon
Posts: 1017
Joined: Thu Oct 18, 2018 1:24 am

Re: Run program without admin privilege in admin mode Everything

Post by raccoon »

Again. The fact that Everything is restricted to running external programs with the same elevation as itself, is a bug, not a feature.

There are multiple Windows API for executing external processes that should all be explored. IE, various ShellExecute() and ShellExecuteEx() flags, besides other functions available.

Insisting that the user not run Everything as Admin is arbitrary and incoherent, because of this bug.
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: Run program without admin privilege in admin mode Everything

Post by NotNull »

How is that a bug?

If you spawn create a child process, that process will run under the same credentials as the parent process. That is Windows design.

It might be inconvenient for your use case, but I can't see a bug here.
raccoon
Posts: 1017
Joined: Thu Oct 18, 2018 1:24 am

Re: Run program without admin privilege in admin mode Everything

Post by raccoon »

Incorrect. Invalid. You wrote: "If you spawn create a child process, that process will run under the same credentials as the parent process. That is Windows design." That is not true. It's only true if you prefer to do it this way. Stop preferring to do it this way and it won't be done this way.
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: Run program without admin privilege in admin mode Everything

Post by NotNull »

And therefor: Not a bug.
raccoon wrote: Sat Nov 14, 2020 7:14 pm Incorrect. Invalid. You wrote: "If you spawn create a child process, that process will run under the same credentials as the parent process. That is Windows design."
I thought that you would understand that it is the Windows design DEFAULT. Of course you can start a child process using different credentials (as I even showed earlier in this thread).


But that is all I have to say about the subject - at least in this thread - as all this turns out to be a waste of my valuable time.
horst.epp
Posts: 1445
Joined: Fri Apr 04, 2014 3:24 pm

Re: Run program without admin privilege in admin mode Everything

Post by horst.epp »

I agree fully with NotNull
Its not a bug and further discussions are useless.
Post Reply