Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

You can do substitutions like this:

C:\WINDOWS\System32>echo %CD:\=/%
C:/WINDOWS/System32
share|improve this answer
    
+1 Nice, I didn't know you could do this. –  Bryan Mar 2 '11 at 23:56
    
I recommend typing CMD /? to a command prompt and reading the result. Do the same thing with other commands that get special mentions, but IF, SET, and FOR all have little gems hidden in their options. –  RBerteig Mar 3 '11 at 6:36
add comment

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.

share|improve this answer
    
thank you! ideally i'd like to do this without downloading anything - i'll hang on and see if anyone else suggests anything, otherwise will accept this. –  Steve333 Mar 2 '11 at 22:40
1  
The GNUWin32 utilities are pleasant to have around because they can reduce friction just enough for small things like this. They are light weight too, its not a huge commitment like an installation of Cygwin would be. –  RBerteig Mar 3 '11 at 6:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.