troubleshooting Question

sed one-liner for windows (bash shell)

Avatar of ugeb
ugebFlag for United States of America asked on
Unix OSScripting LanguagesShell Scripting
8 Comments1 Solution711 ViewsLast Modified:

I'm trying to do a one-liner using sed in a Cygwin bash on Windows.  I want to be able to copy a directory from Windows explorer to Cywin and have it cd to that directory without complaining about the slashes. For example, in explorer I copy the address field that looks like this:

C:\Users\Gene\AppData\Local\Google\Chrome\User Data\Default\Extensions\

I'd like to paste this into bash as follows:

cd C:\Users\Gene\AppData\Local\Google\Chrome\User Data\Default\Extensions\

and have it change directories without complaining about the orientation of the slashes.  The spaces cause an issue too, so I would probably have to do:

cd "C:\Users\Gene\AppData\Local\Google\Chrome\User Data\Default\Extensions\"

I've played around with sed, but I'm no expert on it and it ends up trying to cd to directory:


which doesn't exist.


Duncan Roe
Software Developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros