# Open a random file Batch



## brunchmiracle (Jan 27, 2012)

I really need help in creating a batch file that opens a random file from a text file containing numerous file paths.
The list reads as following:
C:/Users/aas/Pictures/asda.jpg
C:/Users/hgff/Music/adsf.wav
C:/Documents/sdgafg.txt
etc....
I also don't know the exact length of the txt as I want to be able to use this batch on numerous text files


----------



## Squashman (Apr 4, 2003)

We just did a very similar batch file the other day on the forums. Browse thru this forum category. You should be able to find something that will help you. Otherwise you can wait for me to get back on a computer on Monday to give you the code.

Edit: Found the previous thread. Very similar concept.
http://forums.techguy.org/software-development/1036931-if-condition-within-loop-problem.html


----------



## brunchmiracle (Jan 27, 2012)

Thanks squashman,
I found what you were talking about, but am still lacking a few details. I can now form a batch file to call a random line from a txt file and open it, but my problem now lies in that once I get the first random file, the next time I run the batch on the same file I get a file that is only a few hundred lines ahead of the first. For example, when it opens line 11024, the next time i run it it opens line 11161. Any ideas on why this is happening?


----------



## Squashman (Apr 4, 2003)

I am not omniscient. Would actually help to see the code you are using.


----------

