Wednesday, December 17, 2025

Re: Bug with shell command !{cmd} using cmd.exe

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

--
--
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 vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/b07b4f38-80e4-4f9a-9b98-7ac083e79e92%40googlemail.com.

No comments: