Select a random file in Windows Explorer
Selecting a random file in Windows Explorer / File Explorer can be useful. Maybe you want to play a random song or video stored in a folder full of them, set a new wallpaper or play one of the games stored in a folder.
While you can use third-party software for that, most media players come with options to randomize playback for instance, you may like a solution embedded in Windows Explorer as well.
Random Selection Tool is a free tiny program for Windows that adds a random option to Windows Explorer. The program has a size of 10 Kiloybtes packed and 30 Kilobytes unpacked.
First thing you need to do is run it with administrative privileges. This opens a menu that you use to install or remove the explorer context menu addition. On first run you select to add it to Windows Explorer and find that option available when you right-click in a folder in the file browser.
There you find listed the new select random menu option. Selecting it picks a random file that is stored in the directory. The program does not load it directly and there is no option to do so but hitting enter afterwards or double-clicking the file does the trick.
To repeat the selection process right-click and select the random option again from the context menu. It needs to be noted that this works only for the active folder. A right-click on another folder does not display the option which means that you need to browse to the folder before you can make use of the random selection option.
You can uninstall the context menu entry again by running the main Random Selection Tool program as administrator and selecting the remove option that time in the program window that opens up.
Please note that the program has two dependencies. The first is that it requires the Microsoft .Net Framework 4.0 which Windows 8 and newer versions of Windows support out of the box and all other supported versions of Windows can upgrade to if they have not done so already.
The second dependency is the Microsoft Visual C++ 2010 Redistributable Package which needs to be downloaded separately if not already installed on the system.
If you prefer a program that has no dependencies try Pick Me instead which does just that. Select a directory, pick file extensions that you want to include in the selection process and select how many results you want.
Closing Words
Random Selection Tool is a handy program provided that your system meets all the requirements or you don't mind installing them for the program. While it does not add anything major to Windows, selecting a file randomly from a folder can be useful in several occasions.
Doesn’t work if you’re opening a folder from within a program, like for example if you’re trying to open a file from within Photoshop or a game, the option does appear but selecting it does nothing
Doesn’t work on search results
This program does exactly what it says it does. You don’t need to add any accounts to run as administrator, just right click on the executable, then select “Run As Administrator” from the context menu.
I’ve just written FileDice, which can be used as an alternative. Also, it prevents the same file to be randomly selected twice.
http://FileDice.sylde.net
Sylvain.
I love you, thank you for this. I had a 20 gb folder and was worried it’d take the program a while to pick a file but nope, did it in an instant! Do you mind making this code open source? I’d love to learn how you did this thanks.
I can’t figure out how to run with admin privileges. I’ve set up an admin account on my computer but it’s entirely separate from my other account and doesn’t have the selection tool downloaded. What do I need to do?
Yeah seems like a neat little application to have hanging around if ever needed, I usually listen to the Radio more then ever now that I found streamWriter thanks to Martin. Oh and if you fine that the Context Menu is getting over loaded you can try ShellMenuView, it has a simple enable and disable option for just that and more.
Thanks for the Tutorial Martin
I have similar Python script, maybe someone find it usefull: http://pastebin.com/zAynykQM