# CMake 4.0+ treats \\" in path end as escaped quote on Windows

**URL:** https://discourse.cmake.org/t/cmake-4-0-treats-in-path-end-as-escaped-quote-on-windows/15487
**Category:** Usage
**Tags:** os:windows
**Created:** [January 30, 2026, 11:57am UTC](https://discourse.cmake.org/t/cmake-4-0-treats-in-path-end-as-escaped-quote-on-windows/15487 "2026-01-30T11:57:48Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Wovchena](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/w/898d66/32.png) [@Wovchena](https://discourse.cmake.org/u/Wovchena)
#### Post date: [January 30, 2026, 11:57am UTC](https://discourse.cmake.org/t/cmake-4-0-treats-in-path-end-as-escaped-quote-on-windows/15487/1 "2026-01-30T11:57:48Z")

</div>

Create `build.bat` in `cmake-4.2.3-tutorial-source\Step0` downloaded from [https://cmake.org/cmake/help/latest/guide/tutorial/index.html](https://cmake.org/cmake/help/latest/guide/tutorial/index.html) with the following content

```auto
set "SAMPLES_SOURCE_DIR=%~dp0"
cmake "%SAMPLES_SOURCE_DIR%"

```

and run `build.bat`. It fails with CMake 4.2.3 and passes with 3.26.3. The error message is

```auto
CMake Error: The source directory "C:/Users/vzlobin/Downloads/cmake-4.2.3-tutorial-source/cmake-4.2.3-tutorial-source/Step0"" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.

```

The workaround is to add `\.` resulting in `cmake "%SAMPLES_SOURCE_DIR%\."` to avoid escaping `"`. Is this CMake’s bug?

---

<div class="post-metadata">

### Author: ![Wovchena](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/w/898d66/32.png) [@Wovchena](https://discourse.cmake.org/u/Wovchena)
#### Post date: [February 3, 2026, 12:34pm UTC](https://discourse.cmake.org/t/cmake-4-0-treats-in-path-end-as-escaped-quote-on-windows/15487/2 "2026-02-03T12:34:30Z")

</div>

Reported as an issue: [https://gitlab.kitware.com/cmake/cmake/-/issues/27563](https://gitlab.kitware.com/cmake/cmake/-/issues/27563)

---

<div class="post-metadata">

### Author: ![brad.king](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brad.king/32/11_2.png) [@brad.king](https://discourse.cmake.org/u/brad.king)
#### Post date: [February 3, 2026, 2:51pm UTC](https://discourse.cmake.org/t/cmake-4-0-treats-in-path-end-as-escaped-quote-on-windows/15487/3 "2026-02-03T14:51:36Z")

</div>

Your command line really does have an escaped quote, and CMake is correct. I’ve posted a full explanation in the issue.
