Condition „IF†with variable with white space
Posted: 15 Jun 2010 03:23
I have folder with other folders and I want to do something with them but only with some of them.
I have loop which searching all folders, loop have also condition which checking if folder name is different then specified than do something.
Unfortunately some folder have white space in name and my condition doesn’t work
This is my script
After when I added “if not %%a==%name1%” in condition all condition stop working because there is a problem with white space in folder name.
How to resolve this problem?
I have loop which searching all folders, loop have also condition which checking if folder name is different then specified than do something.
Unfortunately some folder have white space in name and my condition doesn’t work
This is my script
Code: Select all
set name1=folder a1
for /f "delims=" %%a in ('dir /b/ad') do (
if not %%a==folder1 if not %%a==folder2 if not %%a==%name1% (
rem do something
)
)
After when I added “if not %%a==%name1%” in condition all condition stop working because there is a problem with white space in folder name.
How to resolve this problem?