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

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
ernest211
Posts: 6
Joined: 14 Jun 2010 06:20

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

#1 Post by ernest211 » 14 Jun 2010 06:50

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.

amel27
Expert
Posts: 177
Joined: 04 Jun 2010 20:05
Location: Russia

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

#2 Post by amel27 » 14 Jun 2010 07:01

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

ernest211
Posts: 6
Joined: 14 Jun 2010 06:20

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

#3 Post by ernest211 » 14 Jun 2010 07:13

Thanks

Post Reply