Celeb Glow
updates | March 06, 2026

Windows: pwd with forward slashes, not back?

Could anyone tell me how I can print the current working directory with forward slashes, not backslashes, from the Windows command line?

Thanks!

UPDATE: preferably I would like to do this without downloading any special utilities, but that may not be possible.

2 Answers

You can do substitutions like this:

C:\WINDOWS\System32>echo %CD:\=/%
C:/WINDOWS/System32
2

You could download GNU utilities for Win32 and use sed.

pwd | sed -e 's!\\!/!g'

c:/Windows

Disclaimer, I don't have a windows PC in front of me to test this, but I have used sed on windows to solve similar problems.

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy