question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`replace` a keyword in windows cmd.exe

See original GitHub issue

Hi! Lovely util. Without all the drama I would’ve never come across it.

Now, I tried using it on Windows, and got really weird behaviour, until I realized that there’s actually a cmd.exe command called “replace”. I solved it by copying .../npm/replace.cmd to .../npm/replacejs.cmd. Maybe it would be good to include that alias by default? Or, if npm allows, by default on Windows systems?

Issue Analytics

  • State:open
  • Created 11 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
joemallercommented, Oct 21, 2016

I’m not using it globally, but the command works perfectly in Windows cmd.exe so long as it’s either called as node_modules\.bin\replace or from a script in package.json. One Windows-specific note which might trip up the unix-fluent (me): Arguments must be enclosed in double-quotes. Single-quotes do something different in the default Window CLI.

C:\Users\joe\Desktop\replacer> node_modules\.bin\replace "foo" "bar" foobar.txt

👍

0reactions
wlaurancecommented, Jan 8, 2014

I have had this problem too. There are several ways to get around it.

  1. make an alias in your shell to whatever you want
  2. directly execute the node_module ./node_modules/.bin/replace
  3. fork it, change the executable name npm install username/replace --save

I’m sure there are plenty more.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Edit/Replace text within a Variable - Windows CMD - SS64
Use the syntax below to edit and replace the characters assigned to a string variable. Syntax %variable:StrToFind=NewStr% %~[param_ext]$variable:Param Key ...
Read more >
How can you find and replace text in a file ... - Stack Overflow
Under Visual Studio: Edit -> Find and Replace In the opened dialog, select your folder and fill in "Find What" and "Replace With"...
Read more >
How can you find and replace text in a file using ... - YouTube
How can you find and replace text in a file using the Windows command-line environment? [ Gift : Animated Search Engine ...
Read more >
How to search and replace a string in multiple text files (within ...
How do I do this via Windows cmd? Please help. windows · command-line · text-editing · find-and-replace.
Read more >
Command-line tip: replace a word in all files in a directory
If you're on Windows you'll need unix command-line tools installed. The easiest way to do that is with Gow. Here's what each piece...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found