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.

I tried to do so by using findstr on %cd% but couldn't find a way to do so without using a file to process. And the g:/ option seems to mean findstr runs interactively and cannot be piped into. So without using files is there a way?

share|improve this question
    
You’ll have to explain a little more; it is not quite clear what you are trying to do or what the problem. –  Synetech Mar 13 '11 at 19:43

1 Answer 1

Assuming that you want to set a variable to contain the name of the parent of the current directory (in a .cmd file):

for %%i in (.) do set parent=%%~dpi
echo parent %parent%

See help for for more information on the tilde substitutions.

If you just want to set a variable to the current directory:

set dir=%cd%
share|improve this answer

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.