Launching BCDEDIT command from TC button bar

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
sidefx88
Senior Member
Senior Member
Posts: 294
Joined: 2007-04-11, 17:07 UTC
Location: Argentina

Launching BCDEDIT command from TC button bar

Post by *sidefx88 »

Hi!

I'm experiencing troubles trying to execute a console command (bcdedit /set {bootmgr} displaybootmenu yes) from a button on TC icons bar.

The code for this button included on default.bar is:

Code: Select all

button1=%COMMANDER_PATH%\Icons\Icons.dll,6
cmd1=cmd
param1=/q /k title From TC|bcdedit /set {bootmgr} displaybootmenu yes
path1=%COMMANDER_PATH%\
iconic1=0
menu1=BCDEDIT (restore Windows boot menu F8)
I have to do right-click on this button, then "Run as admin", but it didn't work. A console window opens and shows the message "bcdedit is not recoginized as an internal or external command."

BUT! If I run a console command from the Windows start menu (with admin rights) a console window shows up and I'm able to type the command (bcdedit /set {bootmgr} displaybootmenu yes) and it actually works.


I use to launch other commands from buttons on TC successfully (using right-click and run as admin), such as this:

Code: Select all

button6=%COMMANDER_PATH%\Icons\icons.dll,12
cmd6=cmd
param6=/q /k title From TC|powercfg /hibernate off
path6=%COMMANDER_PATH%\
iconic6=0
menu6=Disable hibernation and deletes "hiberfil.sys" file
Any ideas why the bcdedit command is not running when launching it from TC?

Thanks!
I Love Total Commander!
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

Do you use TC 32 bit on Windows 64 bit? powercfg.exe exists as 32 and 64 bit executable on Windows x64, but bcdedit.exe only exists once: in %SystemRoot%\system32. Since all 32 bit programs get redirected to %SystemRoot%\SysWOW64 when accessing files in %SystemRoot%\system32, they see different things than 64 bit programs, i.e. they can't access 64 bit executables by default. This also applies to TC. That's why TC shows SysNative pseudo-directory when displaying the contents of %SystemRoot% (which is usually C:\Windows).

See also the Wiki article.

One solution is to use %SystemRoot%\SysNative\bcdedit.exe, but remember that this path only works in 32 bit programs, not in 64 bit applications!

[EDIT] Fixed typo [/EDIT]

Regards
Dalai
Last edited by Dalai on 2018-06-20, 13:35 UTC, edited 1 time in total.
User avatar
sidefx88
Senior Member
Senior Member
Posts: 294
Joined: 2007-04-11, 17:07 UTC
Location: Argentina

Post by *sidefx88 »

Thanks a lot!

It works like a charm!
I Love Total Commander!
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Usually I make a symbolic link named System64 in Windows dir pointing to System32 dir, and it always shows 64-bit folder, regardless of TC bitness (this must be run from elevated command prompt):

Code: Select all

mklink /d %SystemRoot%\System64 %SystemRoot%\System32
So then it is always possible to run 64-bit programs from TC buttonbar:

Code: Select all

%SystemRoot%\System64\bcdedit.exe
Post Reply