Error after [DEBUG:VsDevCmd.bat] calling "ext\"

Weird issue with Visual Studio when trying to build with “make release” command or when creating a project via cmake. For some reason, the "“C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\vsdevcmd\ext” folder is called (without the specified file name), which causes an error. How to fix it?

Something here is wrong. Line break is added at the beginning of the first file name.

File C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/Common7/Tools/VsDevCmd.bat

for /F %%a in ( 'dir "%VS170COMNTOOLS%vsdevcmd\ext\*.bat" /b /a-d-h /on' ) do (
    call :call_script_helper "ext\%%a"
)

Sounds like a corrupted VS install, i’d probably remove and reinstall it see if that helps

I have tried two versions of VS. Possibly a problem with Windows 10. You can try to execute this bat-file. Ideally it should output “name.bat” and not "
name.bat" (with newline at the beginning)

@echo off

for /F %%a in ('dir "." /b /a-d-h /on') do (
    echo "%%a"
)
Microsoft Windows [Version 10.0.19043.2006]
(c) Microsoft Corporation. All rights reserved.

c:\test>name.cmd
"name.cmd"

c:\test>

This command is not working properly for me. Any ideas how to fix it?

E:\temp\1>name.bat
"
name.bat"

E:\temp\1>

No sorry, have not seen this behavior before

There is a suspicion that this is due to git

C:\>where dir
C:\Program Files\Git\usr\bin\dir.exe

C:\>git --version
git version 2.36.0.windows.1

Same issue with the newest git 2.37.3

c:\test>where dir
INFO: Could not find files for the given pattern(s).

c:\test>where git
C:\Program Files\Git\cmd\git.exe

c:\test>git --version
git version 2.23.0.windows.1

Finally managed to solve the problem! Perhaps this is the most non-obvious solution.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor
Autorun = "cls"

changed to

Autorun = ""

Iterating over files in directory prepends extra character to filename

1 Like

That key is not set on any of my systems, would be interesting to figure out what app’s installer thought that was a good idea :slight_smile:

Perhaps I did it myself, but I did not expect such consequences…