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
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!
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
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:
Summary: Hi I have a probelm to search and open a file with a batch program. I have .pdf files in a folder and I want to search these files and when I found what I want than open it. All .pdf file names begin ...
Summary: Hi, I need to write a bacth file to backup the processed file to a backup directory. Backup file name should include the current date at the end. I am facing problem in formatting the date, since the ...
Summary: I need to figure out a method to find and replace text within a text file. I have a file named, "myfile.txt" that has the following; testing=1 database=500 rules=30 I want the batch file to find datab...