Page 1 of 1

Getting full (or short) folder name with white space in loop

Posted: 14 Jun 2010 06:50
by ernest211
Getting full (or short) folder name with white space in loop

Hello, I’m tiring to get all folder name and only folder in loop. I have problem because folder name have whitespace. My loop

for /f %%a in ('dir /b /ad') do (
ECHO "%%a"
)

So if folder name is e.g. “Folder name 1” I’m getting only “Folder”. So how to get full folder name?
I think if I get short name e.g. “Folder~1” also will by good.
I’m need this because I’m trying to write some script which adding user privileges to folders and I’m using for this XCACLS



Ps. Sorry for my horrible English.

Re: Getting full (or short) folder name with white space in

Posted: 14 Jun 2010 07:01
by amel27
ernest211 wrote:Hello, I’m tiring to get all folder name and only folder in loop.

Code: Select all

for /d %%a in (*) do echo.%%a

ernest211 wrote:So if folder name is e.g. “Folder name 1” I’m getting only “Folder”. So how to get full folder name?

Code: Select all

for /f "delims=" %%a in ('dir /b/ad') do echo.%%a

Re: Getting full (or short) folder name with white space in

Posted: 14 Jun 2010 07:13
by ernest211
Thanks