Tuesday, March 7, 2017

windows - Unable to execute FOR loop from batch file

I am trying to execute the following command from inside a batch file:


@echo off & for /f "delims=*" %A in ('dir /s /b') do echo %~fA %~zA >> "\path\to\output.txt"

I found this command from another thread. It prints out the entire file listing along with the file size.


I am able to execute this just fine when pasting into a command line window, but when I throw it into a batch file nothing happens. Am I missing something? Why would this failed when executed from a .bat?

No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...