Closed d4k0 closed 2 years ago
Hi there, thanks for reporting this issue.
This is related to the following line of code: https://github.com/cmderdev/cmder/blob/2acb6808edfd9ea65d8b68cd7085992a7b4e6ca4/vendor/init.bat#L244
I'm not sure specifically why updating Cmder to 1.3.20 caused this issue, but the reason is because the unix find.exe
is overwriting the windows find.exe
in PATH, and since they do completely different things (one finds a file and the other finds a substring in text) they are not compatible.
I'll work on a fix right away, but in the meantime please open Command Prompt, cd
to cmder root and try this command to see if the issue is resolved:
vendor\init.bat /nix_tools 0
if so, I'll make an update to the project that will resolve this issue. You'll need to download only the vendor\init.bat
file from GitHub and replace it in your Cmder directory.
Thanks! 😄
Added a workaround in https://github.com/cmderdev/cmder/commit/8b6d1d8a6f0f88cf50f81c942aa193a261f7051c
@daxgames Can you please have a look and test?
@DRSDavidSoft Thanks for the quick answer. Unfortunately, that doesn't seem to have worked:
@DRSDavidSoft 👍
Simple fully qualified path to find
like %windir%\system32\find .....
would have worked too and may have been easier write and follow. :-)
@daxgames Ok, should I revert to using find.exe
instead, with the fully qualified path?
This was meant to not rely on using external executables, which could potentially slow down the init process.
This line in the commit looks like it will fail when %full_path%
contains spaces:
if not [\%full_path:\cmd\git.exe=:%]==[\%full_path%] (
@daxgames Ok, should I revert to using
find.exe
instead, with the fully qualified path?This was meant to not rely on using external executables, which could potentially slow down the init process.
The fewer external executables and call
commands, the better!!! Both of those can significantly slow down the init process.
@chrisant996 I just did a test and it seems that due to using double quotes, the space might not be an issue:
@echo off
setlocal enabledelayedexpansion
for /F "delims=" %%F in ('where code.cmd 2^>nul') do call :check_code "%%~fF"
:check_code
set full_path="%~f1"
if not defined CODE_INSTALL_ROOT (
if not [\%full_path:\bin\code.cmd=:%]==[\%full_path%] (
echo Executing "%~df1" --version
"%~df1" --version
)
) else (
echo Skipping %full_path%
)
exit /b
Executing "C:\Program Files\Microsoft VS Code\bin\code.cmd" --version
1.70.2
e4503b30fc78200f846c62cf8091b76ff5547662
x64
In any case, I'm wondering which route is the better way to go, using a call :sub_routine
to check substrings with if
and string substitution, or using find.exe
(with the fully qualified path) to filter out lines, and not use a subroutine.
Please feel free to do some tests and use the method that suits best. Thanks! 😄
@d4k0 Please follow these steps to see if the issue is resolved:
curl "https://raw.githubusercontent.com/cmderdev/cmder/master/vendor/init.bat" > %CMDER_ROOT%\vendor\init.bat
Please report back if this solves the issue.
@chrisant996 I just did a test and it seems that due to using double quotes, the space might not be an issue:
... set full_path="%~f1" ...
I see now. I hadn't looked closely enough. Out of curiosity, what is the reason for the surrounding [
..]
? Since %full_path%
already contains quotes, the \
before the %full_path%
on each side looks like there isn't a functional need for the [
..]
, and I made a bad assumption that they were meant to function similar to quotes. But 2 lines earlier there are clearly quotes, I just didn't look far enough, sorry!
The brackets were used mainly for two reasons:
However, I guess using the \
prefix invalidates both reasons, so I'll remove them.
Thanks for taking a closer look!
@DRSDavidSoft No your fix is better. I am the lazy one!
@DRSDavidSoft Unfortunately, the issue persists:
After the restart of Cmder:
@DRSDavidSoft @daxgames another option could be to use findstr
instead of find
. The init.bat file already uses findstr
elsewhere.
@dk40 The find
program is no longer used in the latest init.bat file, so if you're still getting the same error then you don't have the fix yet.
Comment https://github.com/cmderdev/cmder/issues/2766#issuecomment-1283571660 suggests how to download the latest init.bat file for testing purposes.
@chrisant996 As you can see in my first screenshot I downloaded the latest init.bat file using the provided command. The download was successful as the date of the file changed. I then restarted Cmder and took the second screenshot.
Can you please run these commands in cmd.exe
in Cmder root directory:
set CMDER_ROOT=
vendor\init.bat /v
curl "https://raw.githubusercontent.com/cmderdev/cmder/master/vendor/init.bat" > "%CMDER_ROOT%\vendor\init.bat"
Then send a screen shot of the window, close the window
Open cmder.exe
from project root directory, send a screenshot of that
Thanks
@DRSDavidSoft
I accidentally started cmder.exe
instead of cmd.exe
by typing cmder
in the address bar of Windows Explorer and noticed that the message somehow now doesn't appear anymore (that's the cmder
installation where I downloaded the new init.bat
file). Very strange.
I tried your other advice but somehow the init.bat
file isn't updated as the date didn't change:
As I suspected, the init.bat was updated in the other directory.
Can you find the updated file (using the date) in vendor\init.bat, and copy manually to the correct folder, to see if it makes a difference?
If not, please run vendor\init.bat /d
, so the debug mode is turned on, then copy the entire output and post it out as a .txt
file so we can investigate.
Please remove any sensitive information first.
Thanks for putting the effort to debug the issue!
@DRSDavidSoft @daxgames another option could be to use
findstr
instead offind
. The init.bat file already usesfindstr
elsewhere.
I can see the benefit of using findstr.exe
to pipe the output of where
or any command, instead of manually matching the string.
I vote to using findstr instead of find, firstly because the name won't conflict with Unix tools, and second for the sake of using consistent tools in cmder.
Should we revert back to it instead of my method?
I copied the new init.bat
to a fresh installation of cmder
and the message now isn't displayed anymore. Thanks for fixing this!
I copied the new
init.bat
to a fresh installation ofcmder
and the message now isn't displayed anymore. Thanks for fixing this!
Awesome, now we only need to decide which method to use. I vote keeping this one that works, but I'd also like the idea of using findstr
.
I am a for what works and is fastest.
Question
Hi,
I just updated to 1.3.20 and now I get the message "find: ‘\cmd\git.exe’: No such file or directory" every time I start Cmder. I also tried a fresh portable installation, but the same thing is observed there. Is this a bug?
Checklist