Command Line loop to run command on all files in a directory (plus sub directories, if possible

Weird, there was a response that had the recursive part.

Well, per How to Loop Through Files Matching Wildcard in Batch File, I was able to achieve this. Here is how it was performed:

 cd path_to_root
 for /R %%f in (*.tif) do (
 "C:\Program Files\ImageMagick-6.7.6-Q16\convert.exe" -compress LZW 
    -colorspace Gray -colors 32 "%%f" "%%f"
 )

Open PowerShell

$files = Get-ChildItem -Recurse 
foreach ($file in $files){
    c:\windows\System32\notepad.exe $file.FullName
}

Get-ChildItem retrieves a list of files as objects from the current subdirectory. "-recurse" will include sub-directories. This places it into an array $Files.

The foreach loop cycles through each file and calls notepad with the commandline argument of the full file-name path to each file.

CAUTION: Test the above code in a directory with a few small text files, as it will open up an instance of Notepad for each file.

That should give you an idea of how to go about what you're looking to do.