Batch file to find and open largest file

November 8, 2009 at 19:30:10
Specs: Windows 7
I would like to make a batch file that kind find the largest file in a directory and launch it. I have basic batch creation knowledge and I can find the pieces to make this work, I just need help stitching them together.

My thought is that I can turn the batch file into an executable I can launch from Media Center to playback Bluray disks in Media Player Classic Home Cinema. Since the Bluray disk structure is the same from disk to disk, this should work. The main issue is that the file names change. Thanks!


See More: Batch file to find and open largest file

Report •


#1
November 9, 2009 at 03:52:56
"I can find the pieces to make this work"

What pieces do you have?

"I can turn the batch file into an executable"

If you do, please let me know.


=====================================
Helping others achieve escape felicity

M2


Report •

#2
November 9, 2009 at 16:56:56
You can go this route:

@echo off
For /f %%a in ('dir /b /o-s') do (
"%%a"
exit /b
)


Report •

#3
November 28, 2009 at 20:35:55
This batch file, above, works great while it searches the current directory. How can the same concept and results be narrowed to search a mapped network drive subfolder?

Thanks so much in advance!!


Report •

Related Solutions

#4
November 28, 2009 at 22:32:52
Untested:
set someDir=z:\vids
for /f "delims=" %%a in ('dir /b /os "%someDir%"') do set bigFile=%%a
"%someDir%\%bigFile%"

EDIT: Script fixed


Report •

#5
November 29, 2009 at 01:02:24
Thanks for the reply and file. It dosen't open any files and seems to only to be looking in the current folder (C:).

Report •

#6
November 29, 2009 at 01:43:55
I think Razor meant this:

Untested:

set someDir=z:\vids
for /f "delims=" %%a in ('dir /b /os %someDir%') do set bigFile=%%a
"%someDir%\%bigFile%"


Report •

#7
November 29, 2009 at 02:53:10
Or just use the original script and recede it with:

pushd "x:\some\other\place"


=====================================
Helping others achieve escape felicity

M2


Report •


Ask Question