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?

link|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
feedback

1 Answer

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%
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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