Software⏱️ 2 min read📅 2026-05-31

How to Fix: "npm config set registry https://registry.npmjs.org/" is not working in windows bat file

Use quotes around the registry URL to prevent it from being treated as a special keyword.

Quick Answer: Add quotes around the registry URL, e.g. "https://registry.npmjs.org/"

The issue you're facing is due to the way Windows interprets special keywords in batch files. The `set` command in batch files doesn't work with npm's `config set` command. To resolve this, you can use the following methods:

🚀 Method 1: Using the full path to npm

Step 1:

  1. Open your batch file in a text editor and add the full path to npm at the beginning of the script. For example, if you have installed npm globally, it's usually located at `C:in pm.cmd` (on 64-bit systems) or `C:in pm.exe` (on 32-bit systems).

🚀 Method 2: Using the npm executable path

Step 1:

  1. Open your batch file in a text editor and add the full path to the npm executable. For example, if you have installed npm globally, it's usually located at `C:in pm.cmd` (on 64-bit systems) or `C:in pm.exe` (on 32-bit systems).

🎯 Final Words

By following these methods, you should be able to successfully set the npm registry in your batch file.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions