I need to do something similar to this:

dir > %USERNAME%.txt

But what I get is that if the filename has a SPACE(" ") in it, then the name is cut there

I know that if I do this:

set tmp=%USERNAME%.txt

I have the desired filename. So how can I add the quotes ("), or is there another solution?

link|improve this question
feedback

1 Answer

up vote 6 down vote accepted

I suggest you to try

dir > "%USERNAME%.txt"

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.