Page 1 of 1

Run BAT as Admin from User Button?

Posted: 02 Nov 2024 01:57
by Skettalee
I have lots and lots of toolbars buttons along with graphics that I made and some of the buttons I have set to just bring up a list of Batch files to execute like one for running one of the various Ai Tools that I have install on my system with just
On Left Click:

Code: Select all

C:\!Sd\Comfy\ComfyUi.bat
C:\!Sd\FaceFusion\FaceFusion.bat
C:\!Sd\ForgeUi\ForgeUi.bat
C:\!Sd\roop-unleashed\Roop-Unleashed.bat
C:\!Sd\Rope-Next\Rope-Next.bat
C:\!Sd\Rvc\RVC.bat
Which brings up a list with those files listed like this:
Screenshot 2024-11-01 194953.png
Screenshot 2024-11-01 194953.png (75.29 KiB) Viewed 1524 times

Now i like being able to do this as I do so much and sometimes quickly want to access various things. But well besides the main question do people also know how to do that menu thing but be able to maybe change the list to have icons and possibly change the text you want to see for each item like possibly :

Code: Select all

"ComfyUi" C:\!Sd\Comfy\ComfyUi.bat Icon:comfyui.ico
"FaceFusion" C:\!Sd\FaceFusion\FaceFusion.bat Icon:C:\Users\damie\AppData\Roaming\XYplorer\Icons\facefusion.ico
"ForgeUi" C:\!Sd\ForgeUi\ForgeUi.bat icon: D:\_Damien\Icons\Custom\Labeled\Ai Artwork.ico
"Roop-Unleashed" C:\!Sd\roop-unleashed\Roop-Unleashed.bat Icon:roop-unleashed.ico
etc...


But my main question is there are times where I need to run any given BAT file as Administrator and through that menu method I dont know how to accomplish this, does anyone know how to make "FROM A BUTTON" it execute a file as administrator? :?:

Re: Run BAT as Admin from User Button?

Posted: 02 Nov 2024 10:32
by eil
Considering 1 question - check scripting command popupmenu() = it allows to create custom menus with custom_name,path,custom_icon format items.

Not sure about per-item "run as admin", my guess would be if XY is initially started "as admin" any file it runs will be run same, but not sure here, so maybe smbd will say more.

Re: Run BAT as Admin from User Button?

Posted: 02 Nov 2024 10:37
by Skettalee
eil wrote: 02 Nov 2024 10:32 maybe smbd will say more.
Server Message Block Daemon? Something Must Be Done? I dont understand smbd.

I will look into the popupmenu() command too, thanks!

Re: Run BAT as Admin from User Button?

Posted: 02 Nov 2024 10:39
by eil
smbd= somebody. :lol:

Re: Run BAT as Admin from User Button?

Posted: 02 Nov 2024 11:22
by highend

Code: Select all

    $elevate = "path to nircmd\nircmd.exe";
    run lax("$elevate" elevatecmd exec runas "<curitem>");
https://www.nirsoft.net/utils/nircmd.html

Re: Run BAT as Admin from User Button?

Posted: 02 Nov 2024 12:08
by admin
In the next beta (v26.60.0101) this should run a BAT file in an elevated process (pops the UAC prompt) :

Code: Select all

open "E:\Test\BAT\test.bat", we;