Computing.Net > Forums > Programming > Batch file to find and open largest file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch file to find and open largest file

Reply to Message Icon

Name: skurtis
Date: November 8, 2009 at 19:30:10 Pacific
OS: Windows 7
Subcategory: Batch
Comment:

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!



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: November 9, 2009 at 03:52:56 Pacific
Reply:

"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


0

Response Number 2
Name: viddywell
Date: November 9, 2009 at 16:56:56 Pacific
Reply:

You can go this route:

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


0

Response Number 3
Name: modit
Date: November 28, 2009 at 20:35:55 Pacific
Reply:

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!!


0

Response Number 4
Name: Razor2.3
Date: November 28, 2009 at 22:32:52 Pacific
Reply:

Untested:

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

EDIT: Script fixed


0

Response Number 5
Name: modit
Date: November 29, 2009 at 01:02:24 Pacific
Reply:

Thanks for the reply and file. It dosen't open any files and seems to only to be looking in the current folder (C:).


0

Related Posts

See More



Response Number 6
Name: klint
Date: November 29, 2009 at 01:43:55 Pacific
Reply:

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%"


0

Response Number 7
Name: Mechanix2Go
Date: November 29, 2009 at 02:53:10 Pacific
Reply:

Or just use the original script and recede it with:

pushd "x:\some\other\place"


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

M2


0

Sponsored Link
Ads by Google
Reply to Message Icon





Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: Batch file to find and open largest file

find and open with batch www.computing.net/answers/programming/find-and-open-with-batch/17230.html

batch file to find and copy www.computing.net/answers/programming/batch-file-to-find-and-copy/9236.html

Find and Replace text in Batch File www.computing.net/answers/programming/find-and-replace-text-in-batch-file/12413.html