Page 1 of 2
Restart Elevated
Posted: 23 Dec 2014 10:45
by Adequat
I regularly do this:
quit XY
relaunch it in administrator mode
do several stuff in this mode
quit XY
relaunch it in normal mode
To save time, it would be fine to have an option "Restart Elevated" and another one "Restart"
Re: Restart Elevated
Posted: 23 Dec 2014 11:27
by Enternal
A workaround is go to
http://www.nirsoft.net/utils/nircmd.html and download nircmd. Extract both executables and put them in C:\Windows\.
Now make a new Custom Toolbar Button. For the script, use:
Code: Select all
Run """nircmd"" elevate ""<xy>"" /ini=""<xyini>"" ""<curpath>""";

- 2014-12-23 02_25_40-Edit User Button.png (32.35 KiB) Viewed 5181 times
There is some nice added benefits with the script above. XYplorer will open up a new process that is elevated. The old one will still be running so you won't lose anything. Do what you need with the elevated XYplorer process and then simply quite without saving. Voila!
Re: Restart Elevated
Posted: 23 Dec 2014 12:06
by PeterH
If thinking of nircmd: use WSCC (Windows System Control Center) - it includes many many tools, also nircmd. It really can be helpful!
(Can be used portable!)
Re: Restart Elevated
Posted: 23 Dec 2014 12:21
by Enternal
PeterH wrote:If thinking of nircmd: use WSCC (Windows System Control Center) - it includes many many tools, also nircmd. It really can be helpful!
(Can be used portable!)
Completely agree and support! I have it on my USB drive with me as well. Excellent stuff! It's a bit of overkill but I also have GEGeek Tech Toolkit just in case zombie apocalypse. Although XYplorer during a zombie apocalypse should be my primary tool...

Re: Restart Elevated
Posted: 23 Dec 2014 12:26
by bdeshi
This might be easier. And altogether cleaner (you don;t have to download anything, not saying nircmd is bad though).
Enter
into the addressbar. A textbox will open. Copy the following code and paste it into that box (and ENTER).
Code: Select all
Snip: CTB 1
XYplorer 14.80.0000, 12/23/2014 5:23:29 PM
Action
NewUserButton
Name
Restart...
Icon
:refresh
ScriptL
"Open new ELEVATED XYplorer"
$elevator = "<xyscripts>\utils\elevXY.vbs";
writefile($elevator, <<<#elevcontent
set oSh = CreateObject("Shell.Application")
oSh.ShellExecute "<xy>", "/new", "", "runas"#elevcontent,o);
}
//savesettings;
run "wscript.exe ""$elevator"" ""<xy>""",,0,0;
"-"
"Restart with ELEVATED privileges"
$elevator = "<xyscripts>\utils\elevXY.vbs";
writefile($elevator, <<<#elevcontent
set oSh = CreateObject("Shell.Application")
oSh.ShellExecute "<xy>", "", "", "runas"#elevcontent,o);
}
savesettings;
run "wscript.exe ""$elevator"" ""<xy>""",,0,0;
exit n;
"Restart with UNELEVATED privileges"
savesettings;
run "%WINDIR%\explorer.exe ""<xy>""";
exit n;
"Restart in current mode (saving settings)"
exit sr;
ScriptR
FireClick
0
Now a new button will get added to the toolbar.
Click it to: restart ELEVATED (using vbscript), or
UNELEVATED (using explorer.exe

) or just restart in current mode. You can also open a new ELEVATED instance of XYplorer.
(edit) Don't ask me why explorer can start things in
unelevated mode FROM WITHIN an elevate program. Where cmd.exe ,psExec from sysinternals, and runas /trustlevel:0x2000 all failed. I know I'll not forget this interesting and quite useful (

) feature of WE.
(edit2: added new "Open new elevated instance" option to the ctb)
Re: Restart Elevated
Posted: 23 Dec 2014 12:58
by Marco
SammaySarkar wrote:
(edit) Don't ask me why explorer can start things in
unelevated mode FROM WITHIN an elevate program. Where cmd.exe ,psExec from sysinternals, and runas /trustlevel:0x2000 all failed. I know I'll not forget this interesting and quite useful (

) feature of WE.
Explorer is not the only one. CPAU (
http://www.joeware.net/freetools/tools/cpau/index.htm ) can do the same thing. But it won't be able to do the reverse on NT 6.x, i.e. where there's UAC - starting something elevated from an
unelevated environment.

Re: Restart Elevated
Posted: 23 Dec 2014 13:07
by Enternal
Really? Making me all jelly with that code. Well, nircmd still has its own uses like opening cd trays and other advance features. With it I can at least claim that XYplorer can open CD trays so that I can use them as cup holders.
Joking aside, that's actually quite neat! I really need to learn vbscript.
Re: Restart Elevated
Posted: 23 Dec 2014 13:41
by Filehero
Hi,
this logic really should be made XY-intern, maybe added to the
File menu as
Restart Elevated and/or
Start Elevated Instance.
@Sammay:
Filehero
SammaySarkar wrote:This might be easier. And altogether cleaner (you don;t have to download anything, not saying nircmd is bad though).
Enter
into the addressbar. A textbox will open. Copy the following code and paste it into that box (and ENTER).
Code: Select all
Snip: CTB 1
XYplorer 14.80.0000, 12/23/2014 5:23:29 PM
Action
NewUserButton
Name
Restart...
....[/quote]
Re: Restart Elevated
Posted: 23 Dec 2014 14:37
by aliteralmind
Why do you need to switch back and forth between elevated and not? Why not just stay elevated?
I'm genuinely curious.
Re: Restart Elevated
Posted: 23 Dec 2014 14:47
by Filehero
aliteralmind wrote:Why not just stay elevated?
My standard account isn't a/the admin one, so I wouldn't see all my account specific folders and links (user.home, desktop, documents etc.).
In this general regard - and even if it might not be required any longer under Win 8.x - I'm truly an old-fashioned guy, I
sudo on demand only.
Cheers,
Filehero
Re: Restart Elevated
Posted: 23 Dec 2014 14:51
by Enternal
aliteralmind wrote:Why do you need to switch back and forth between elevated and not? Why not just stay elevated?
I'm genuinely curious.
Problem with staying elevated all the times is elevated programs don't always play nice with all other programs that are not elevated due to permissions and such. In most cases, you don't want to elevate a program unless it's necessary.
Re: Restart Elevated
Posted: 23 Dec 2014 15:37
by PeterH
aliteralmind wrote:Why do you need to switch back and forth between elevated and not? Why not just stay elevated?
Security! I generally work as a normal user, and only if it's really neccessary I run it elevated.
Re: Restart Elevated
Posted: 23 Dec 2014 15:43
by aliteralmind
Well, it would be nice to bypass the UAC prompt, by calling an already-elevated shortcut. I'm guessing this isn't possible via an XY internal implementation, but perhaps it's scriptable.
Re: Restart Elevated
Posted: 23 Dec 2014 16:07
by bdeshi
no good program wearing a white hat should try to bypass the UAC.

Re: Restart Elevated
Posted: 23 Dec 2014 16:17
by Filehero
aliteralmind wrote:I'm guessing this isn't possible via an XY internal implementation, but perhaps it's scriptable.
I do expect, that what Sammay's VBS script does indeed can be done with VB6.