# terminal: Fix double quoting of commands on Windows cmd.exe \(\#47534\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/7af276a984a4dd2167dea58451972f044792919d)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 7af276a984a4dd2167dea58451972f044792919d

Requested commit: 7af276a984a4dd2167dea58451972f044792919d

Commit: 7af276a984a4dd2167dea58451972f044792919d

Tree: 1c63609678336105f7bd044b31e0bbbe7872125e

Author: Xin Zhao

Committer: GitHub

## Message

```
terminal: Fix double quoting of commands on Windows cmd.exe (#47534)

Closes #47303 

The command quoting for `cmd` shell was first introduced (at least in
this case) in PR #41216 three months ago:

https://github.com/zed-industries/zed/blob/3d4582d4dc9145270650e12f9ce5a534b888f4a2/crates/project/src/terminals.rs#L202-L210

And a month ago, PR #42382 added command quoting for `cmd` in a
different place:

https://github.com/zed-industries/zed/blob/3d4582d4dc9145270650e12f9ce5a534b888f4a2/crates/util/src/shell.rs#L413-L434

As a result, the command is now quoted twice when using `cmd`. `cmd`
interprets the entire double-quoted string (e.g., ""command & args"") as
a single (invalid) executable name, and this would lead to an error like
“The system cannot find the path specified” in #47303 .

The solution is to remove the redundant manual quoting in `terminals.rs`
and rely on the centralized logic in `util/src/shell.rs`.

/cc @Veykril @reflectronic 

Release Notes:

- Fixed a bug where terminal tasks failed to start on Windows when using
`cmd.exe`.
```

## Parents

- [b397bd049a868935f0e931bdfce851895d65ae41](https://git.cafe/gitcafe/zed/commit/b397bd049a868935f0e931bdfce851895d65ae41?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/7af276a984a4dd2167dea58451972f044792919d?format=markdown)
