Tcc does not recognize "bcdedit"

Feb 26, 2019
6
0
if I run the following command from the tcc.exe console it does not recognize it:

bcdedit /set {default} safeboot minimal
 

rconn

Administrator
Staff member
May 14, 2008
10,986
98
Please post TCC/LE questions in the TCC/LE forum; this forum is for the full Take Command & TCC versions.

Do a "DIR c:\windows\system32\bcdedit.exe".

Are you running a 32-bit version of TCC/LE in a 64-bit version of Windows? If so, Windows is going to remap your directories, and you'll be running from the SYSWOW64 directory instead of the SYSTEM32 directory. And the SYSWOW64 directory does not have BCDEDIT.EXE.
 
Feb 26, 2019
6
0
You are right. I am running tcc.exe (LE) x86 on a Windows x64. But I am calling the program directly in its path (c:\windows\ system32\bcdedit.exe / deletevalue {default} safeboot) and I can place bcdedit.exe in another path and the same thing happens. In cmd you can do this (call programs directly to its path)
 
Code:
[c:\utils]ver

TCC LE  14.00.9   Windows 7 [Version 6.1.7601]
Code:
[c:\utils]dir c:\bcdedit.exe /s/b/p
C:\Windows\winsxs\amd64_microsoft-windows-b..iondata-cmdlinetool_31bf3856ad364e35_6.1.7601.17514_none_e6510234bbcb2a8c\bcdedit
.exe
C:\Windows\winsxs\amd64_microsoft-windows-b..iondata-cmdlinetool_31bf3856ad364e35_6.1.7601.23572_none_e6978f6dd51b7569\bcdedit
.exe
So, on my Windows 7 64-bit system running TCC LE 14.00.9, bcdedit.exe is not visible.
Code:
[c:\utils]which bcdedit.exe
bcdedit.exe is an unknown command
...but is visiable, and usable, from;
Code:
c:\users\jlc\utils>ver

TCC  24.01.41 x64   Windows 7 [Version 6.1.7601]

c:\users\jlc\utils>which bcdedit.exe
bcdedit.exe is an external : C:\Windows\system32\bcdedit.exe
Joe
 

rconn

Administrator
Staff member
May 14, 2008
10,986
98
But I am calling the program directly in its path (c:\windows\ system32\bcdedit.exe / deletevalue {default} safeboot
You are calling the program directly, however Windows (not TCC/LE) is rewriting your path and trying to execute "c:\windows\SysWow64\bcdedit.exe".

This is a Windows issue, not a TCC/LE one. There is no reason to run the 32-bit TCC/LE; you should be running the x64 version. It will then behave the same way as CMD.EXE (which is also 64-bit). Running a 32-bit command processor in 64-bit Windows is going to have a lot of issues - in addition to the file system redirection, Windows will also remap your registry reads & writes. And the 64-bit TCC/LE will be significantly faster.

A partial alternative if you refuse to run x64 TCC/LE is to disable the Windows redirection in TCC/LE (see OPTION / Startup).
 
Ditto for 32-bit cmd.exe
Code:
c:\utils>bcdedit
'bcdedit' is not recognized as an internal or external command,
operable program or batch file.

c:\utils>c:\windows\system32\bcdedit.exe
'c:\windows\system32\bcdedit.exe' is not recognized as an internal or external command,
operable program or batch file.
bcdedit.exe only works if you are running it from 64-bit cmd.exe

Joe
 
Feb 26, 2019
6
0
I created a copy of the program and put it in c: \ test (along with tcc.exe). And I have called the program directly in the new path and it does not work either (this can be done in cmd.exe)2264
 
On a 64-bit system, 32-bit cmd.exe and 32-bit tcc.exe cannot run the 64-bit bcdedit.exe.
Code:
c:\users\jlc\utils>file c:\windows\system32\bcdedit.exe
c:\windows\system32\bcdedit.exe: PE32+ executable (console) x86-64, for MS Windows
You can obtain a 32-bit bcdedit.exe from a Windows x86 version, but I would not recommend it.

Joe
 
This will only work if you run it from a 32-bit command processor, such as TCC/LE 14 32-bit, or 32-bit cmd.exe on a 64-bit OS.

If you run it from a 64-bit command processor on a 64-bit OS, it will not work.

A 64-bit command processor on a 64-bit OS cannot see the c:\windows\sysnative folder.
A 32-bit command processor on a 64-bit OS can see the c:\windows\sysnative folder.

Joe
 
From File System Redirector - Windows applications;

32-bit applications can access the native system directory by substituting %windir%\Sysnative for %windir%\System32. WOW64 recognizes Sysnative as a special alias used to indicate that the file system should not redirect the access. This mechanism is flexible and easy to use, therefore, it is the recommended mechanism to bypass file system redirection. Note that 64-bit applications cannot use the Sysnative alias as it is a virtual directory not a real one.

Joe
 
May 20, 2008
9,344
62
Syracuse, NY, USA
On a 64-bit system, 32-bit cmd.exe and 32-bit tcc.exe cannot run the 64-bit bcdedit.exe.
Sure they can ... once the program can be found.
Code:
v:\> copy c:\Windows\system32\bcdedit.exe
C:\Windows\system32\bcdedit.exe => V:\bcdedit.exe
     1 file copied

v:\> c:\Windows\SysWOW64\cmd
Microsoft Windows [Version 10.0.18346.1]
(c) 2018 Microsoft Corporation. All rights reserved.

v:\> v:\bcdedit.exe /?

BCDEDIT - Boot Configuration Data Store Editor

The Bcdedit.exe command-line tool modifies the boot configuration data store.
<SNIP>
 
Yes, but the file first has to be copied via a 64-bit console. On my 64-bit Windows 7, from the 32-bit TCC/LE;
Code:
TCC LE  14.00.9   Windows 7 [Version 6.1.7601]
Copyright 2016 JP Software Inc.  All Rights Reserved

[c:\utils]copy c:\windows\system32\bcdedit.exe
TCC: (Sys) The system cannot find the file specified.
 "C:\windows\system32\bcdedit.exe"
     0 files copied

[c:\utils]copy c:\windows\sysnative\bcdedit.exe
C:\windows\sysnative\bcdedit.exe => C:\utils\bcdedit.exe
     1 file copied
Copying the file via sysnative works via a 32-bit console.

You are correct, though, when you say that 32-bit TCC/LE can run bcdedit.exe once the file has been copied.

I just don't think it wise to move a Microsoft Windows executable around, as Microsoft might one day do an update that replaces the bcdedit.exe, then there would be two versions of bcdedit.exe on the system.

Joe
 
nbtstat.exe has the same problem as bcdedit.exe, that is, running 32-bit TCC/LE or 32-bit cmd.exe on a 64-bit Windows OS;
Code:
[c:\utils]nbtstat.exe
TCC: Unknown command "nbtstat.exe"

[c:\utils]dir %windir%\system32\nbtstat.exe

 Volume in drive C is WINDOWS        Serial number is h0h0:h0h0
TCC: (Sys) The system cannot find the file specified.
 "C:\Windows\system32\nbtstat.exe"
                 0 bytes in 0 files and 0 dirs
   550,583,676,928 bytes free

[c:\utils]dir %windir%\sysnative\nbtstat.exe

 Volume in drive C is WINDOWS        Serial number is h0h0:h0h0
 Directory of  C:\Windows\sysnative\nbtstat.exe

 7/13/2009  20:39          17,920  nbtstat.exe
            17,920 bytes in 1 file and 0 dirs    20,480 bytes allocated
   550,583,152,640 bytes free
Joe
 
Aug 23, 2010
377
5
Adding to the thread: 64-bit Windows can not run 16-bit executables, DOS or Windows, there's just no subsystem to run them.
 
May 26, 2008
505
3
OP:

As mentioned earlier in the thread, you really should be running a 64-bit TCC on 64-bit Windows.
This is not a TCC issue in of itself.