简体   繁体   中英

recursive directory loop for symlinks in batch

I am trying to follow the tutorial here , but it is leaving many things unanswered for me. I have a folder on a mapped network drive that, for now, I just want to loop through the directory and for each file echo it (eventually I want to examine them and make symlinks...) here is what I have so far:

@echo off
setlocal EnableDelayedExpansion 
for /f %%f in ('dir /b "X:\path\to\stuff"') echo %%f

when I run this I am getting :echo was unexpected at this time. From what I can tell, this is a syntax error, or...?

for /f %%f in ('dir /b "X:\path\to\stuff"') do echo %%f

you need do ...

though if you have white spaces in file names it will be better to use:

for /f "tokens=* delims=" %%f in ('dir /b "X:\path\to\stuff"') do echo %%f

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM