# read-cmd-shim

> Figure out what a cmd-shim is pointing at. This acts as the equivalent of fs.readlink.

Latest version **7.0.0** (published 2026-05-08) · ISC license · 0 weekly downloads

## Install

```sh
npm install read-cmd-shim
pnpm add read-cmd-shim
yarn add read-cmd-shim
bun add read-cmd-shim
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; has provenance; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 7.0.0 |
| Published | 2026-05-08 |
| First published | 2015-09-09 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Node | ^22.22.2 \|\| ^24.15.0 \|\| >=26.0.0 |
| Dependencies | 0 |
| Unpacked size | 5.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 11 |
| Author | GitHub Inc. |
| Maintainers | saquibkhan, npm-cli-ops, reggi, owlstronaut |

## Links

- npm: https://www.npmjs.com/package/read-cmd-shim
- Repository: https://github.com/npm/read-cmd-shim
- Homepage: https://github.com/npm/read-cmd-shim#readme
- Issues: https://github.com/npm/read-cmd-shim/issues
- npm.io page: https://npm.io/package/read-cmd-shim

## Recent versions

- 7.0.0 (latest) — 2026-05-08
- 6.0.0 — 2025-10-23
- 5.0.0 — 2024-09-24
- 4.0.0 — 2022-10-14
- 3.0.1 — 2022-08-16
- 3.0.0 — 2022-04-05
- 2.0.0 — 2020-01-27
- 1.0.5 — 2019-11-05
- 1.0.4 — 2019-08-20
- 1.0.3 — 2019-08-14
- 1.0.2 — 2019-08-14
- 1.0.1 — 2015-09-09
- 1.0.0 — 2015-09-09

## README

# read-cmd-shim

Figure out what a [`cmd-shim`](https://github.com/ForbesLindesay/cmd-shim)
is pointing at.  This acts as the equivalent of
[`fs.readlink`](https://nodejs.org/api/fs.html#fs_fs_readlink_path_callback).

### Usage

```
const readCmdShim = require('read-cmd-shim')

readCmdShim('/path/to/shim.cmd').then(destination => {
  …
})

const destination = readCmdShim.sync('/path/to/shim.cmd')
```

### readCmdShim(path) -> Promise

Reads the `cmd-shim` located at `path` and resolves with the _relative_
path that the shim points at. Consider this as roughly the equivalent of
`fs.readlink`.

This can read both `.cmd` style that are run by the Windows Command Prompt
and Powershell, and the kind without any extension that are used by Cygwin.

This can return errors that `fs.readFile` returns, except that they'll
include a stack trace from where `readCmdShim` was called.  Plus it can
return a special `ENOTASHIM` exception, when it can't find a cmd-shim in the
file referenced by `path`.  This should only happen if you pass in a
non-command shim.

### readCmdShim.sync(path)

Same as above but synchronous. Errors are thrown.

---
_Source: https://npm.io/package/read-cmd-shim · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
