'/d' is not recognized as an internal or external command CC Switch
Quick fix
Bypass '/d' errors by using English directories or mklink /J junctions; fix permanently by ensuring .bat files use CRLF and chcp 65001.
Symptom
Section titled “Symptom”'/d' 不是内部或外部命令'/d' is not recognized as an internal or external command
When CC Switch on Windows clicks 'Open Terminal' on a provider card and selects a Chinese directory in the folder picker, it writes the working directory into %TEMP%\cc_switch_claude_*.bat. The src-tauri/src/commands/misc.rs file generating this .bat uses Rust multi-line strings where most lines are LF, but the cwd_command line is hardcoded as CRLF, causing mixed LF/CRLF usage. cmd.exe only treats CRLF as line endings, so @echo off and cd /d "..." are concatenated by LF: with English paths, they are just echoed without changing directories or errors; with Chinese paths, UTF-8 bytes are parsed as garbled text by the GBK(936) code page, breaking argument parsing, causing cmd to execute /d as an independent command and reporting '/d' is not recognized as an internal or external command. This issue may also appear as #3852's The filename, directory name, or volume label syntax is incorrect. or System cannot find the path specified. forms.
Temporary workaround: Change the target working directory to a pure English path, or run `mklink /J D:\my-project "D:\我的项目"` and then select the English junction path.
Source fix: When generating temporary .bat in `src-tauri/src/commands/misc.rs`, ensure all line breaks explicitly use `\r\n`, and add `chcp 65001 >nul` after `@echo off` so cmd parses Chinese paths with the UTF-8 code page.
// src-tauri/src/commands/misc.rslet content = format!("@echo off{cwd_command}echo Using provider-specific claude config:...", ...);let content = format!("@echo off\r\nchcp 65001 >nul\r\n{cwd_command}echo Using provider-specific claude config:\r\n...\r\n", ...);
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 2 real issues
- Why do English paths not report errors, while only Chinese paths report '/d'?
- Because LF concatenates @echo off and cd /d; for English paths, they are merely echoed without errors but do not change directories; for Chinese paths, UTF-8 bytes are parsed as garbled text by the GBK(936) code page, breaking argument parsing, causing /d to be executed as a command.
- Why do I also see System cannot find the path specified. / The filename, directory name, or volume label syntax is incorrect.?
- These are variants of the same Chinese path/encoding issue. Even if line breaks are fixed, if .bat still writes Chinese in UTF-8 while cmd defaults to GBK(936), cd /d may fail to find the directory and report System cannot find the path specified.
- Is there a temporary solution without modifying source code?
- Yes. Changing the working directory to a pure English path is most stable; you can also use mklink /J to create an English NTFS junction pointing to the Chinese directory, then let CC Switch select that junction path.
Related problems
Section titled “Related problems”This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.