Code: Select all
@echo off
SETLOCAL ENABLEEXTENSIONS
SETLOCAL DISABLEDELAYEDEXPANSION
for /f %%J in ('"dir /A-D /S /B H:\Script\test\batch"') do (
echo %%J
REM do_something...
)
gives something like....
G:\scripts\New (whereas the folder name is "New Folder")
G:\scripts\my (whereas the filename is "my file.txt")
G:\scripts\script.bat (works fine when there is no space in file or folder)
What do I need to change to get the entire filename or folder name?
I am trying this on Windows Vista Enterprise edition. Running just the "dir" command gives all folders and files with spaces, too.
Your help is greatly appreciated. Thank you.