On 2025-12-18 1:47 am, 'Jürgen Krämer' via vim_use wrote:
Hi,
Chainsaw schrieb am 18.12.2025 um 06:25:
I just switched from Windows 10 to Windows 11, and found a strange bug
with Vim in Windows 11.
Steps to reproduce:
1) execute command :!start c:\windows\system32\cmd.exe (or
:!c:\windows\system32\cmd.exe)
2) in the opened cmd.exe window, cd to a directory that contains a
.cmd
or .bat file, example cd c:\batch\test
3) run a .cmd or .bat file, say test.cmd, you will get 'test.cmd' is
not
recognized as an internal or external command, operable program or
batch
file
4) then in same window, run c:\batch\test\test.cmd and it will work ok
This only happens with a cmd.exe window opened from Vim using !.
Thanks
have a look at
:help $NoDefaultCurrentDirectoryInExePath
I don't know if there is a way to disable this behavior in Vim. You
might
need to
set NoDefaultCurrentDirectoryInExePath=
or
set PATH=.;%PATH%
in your cmd or get into the habit of explicitly prepending ".\" to the
names of executables from the current directory when you want to run
them,
e.g.,
.\my-program-from-here.exe param1 param2
Regards,
Jürgen
--
~
~
~
:wq
--
The PATH variable does not matter for an executable if you are in the
directory of the executable, or using the absolute path. When a command
is issued at the CMD prompt, the Operating System will first look for an
executable file in the current folder, if not found it will scan %PATH%
to find it. In a CMD prompt window not launched from Vim, even if you
null the path with 'PATH ;' or set "PATH=", any executable in the
current directory will be found.
This odd behavior is only from a CMD window launched from Vim, and in
Windwso 10 I did not have this problem, it just worked.
Anyway, you did give me an idea for a workaround.
This works:
!start c:\windows\system32\cmd.exe /k path \%path\%;.
I still would like to know why this happens in Windows 11 (I do consider
this a bug because I should not have to include current directory in
path).
Thanks
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/vim_use/94d676b4f5cf0cb08809373f9d67587d%40fourbarlinkage.net.