Introduction: How to Associate .torrent Files in Windows With a Web-based Torrent System

    As you all know, .torrent files are files used with the BitTorrent P2P Protocol, and hold the metadata needed to start the file transfer. However, there is no built-in torrent software with windows, so users must either get a torrent program (such as BitTorrent) or use a web-based service (such as BitLet.org, the website used in this instructable). However, the downloaded torrent programs can be, well, "contraband" in some places, and web-based services often require some human input. If only the web-based torrent services had the automation of the downloaded programs... Well, look no further! This instructable will show you how to associate .torrent files with a web-based torrent service. For this instructable, we will be using Bitlet.org, a simple java-based torrent applet.

Step 1: The Disclaimer

This software is provided "AS IS" without any warranty of any kind. In no event will the author (I) be liable for any damages caused by the use (or inability to use) this product.

Torrents can be used legally (and illegally). I am in NO WAY responsible for what legal trouble you get into if you use this to download an illegal file. I am also not responsible for any technical issues that arise from downloading a torrent infected with a virus. This is a simple batch file, and cannot contain any viruses.

I am in no way affiliated with BitLet.org or Faith Kodak.


PS: For those who are lazy, skip to step 7.

Step 2: Requirements

1. Windows 2000/XP/Vista/7
2. Ability to use the command prompt
3. A web browser (You're looking at this, so obviously you have one) with Java
4. A web-based torrent client, like Bitlet.

Step 3: Check the Syntax of Your Torrent Client.

You must know how the URL of the torrent client is formatted, in order for Windows to send it the filename correctly. For Bitlet, the syntax is very simple:

www.bitlet.org/download?torrent=(YOUR FILE NAME)

for web-based files, and:

www.bitlet.org/download?torrent=file:/(LOCAL FILE NAME)

for local torrents. Windows will download the torrent to the %TEMP% directory, so we'll be using the local filename syntax. If you don't use BitLet, you're on your own.

Step 4: Start the Batch File.

We'll need a batch file in order for windows to open up the right page. The code is very simple. Create a blank text file in the folder of your choice, and rename it to "Bitlet Client Test.bat". Windows may tell you that changing a file's extension can destabilize the file, just click yes. If it doesn't prompt you, then go to Control Panel>Folder options>View>uncheck "Hide extensions for known file types" and click OK. Go back to the Bitlet Client Test file and make sure the .txt extension is removed. Once the text file has been changed to a batch file, Right-click on it and select "edit". Notepad (or some other text program) will pop up with a blank screen. Paste in the following 3 lines of code:

@echo OFF
START "" "http://www.bitlet.org/download?torrent=file:/%~dpnx1"
exit

Line 1 turns off echoing in the command prompt (change OFF to ON to debug)
Line 2 tells your favorite web browser to start up and go to the torrent downloader applet. %~dpnx1 is automatically replaced with the Drive, Path, Name, and Extension of the file to be opened by windows. Without the first set of empty quotes, a command prompt window will open with the URL as the title.
Line 3 tells the window to close.

Save and exit.
For those who aren't using bitlet, you'll need to change the link to the torrent downloader in line 2 & use "%~dpnx1" for the name of the file to be downloaded.



Step 5: Test.

Run the batch file. Your web browser should pop up and go to the torrent applet. Bitlet will throw back an error saying "could not download metafile". Ignore it. We just need to know that it works. If you want, try it with a test torrent file. Dragging and dropping onto the batch file should work.

Step 6: Convert to an .exe File

*If you want this to be a plain-jane batch file, then skip this step*

Start up your .bat to .exe converter (one is provided) and select the options as shown in the picture:

Click "Complile", then click "Exit" once the popup disappears.

If you want, you can add an icon in the third tab.

Skip to Step 8.

Step 7: Files (For the Lazy Ones...)

If you didn't have the time (or the work ethic) to follow the instructable, then use these files. You'll still need to do steps 8 & 9.

Step 8: Associate in Windows.

Move the file (be it batch or executable) to a safe place. Get a torrent file to use, and right-click>open with...>Choose Default (might be a different name in 2000/XP/7). Browse to the .bat or .exe, and select it. Make sure that it sets it as the default program, then click OK.

Step 9: Moment of Truth!

After clicking OK, the bitlet page should fire up and and prompt for a directory. If not, or if any errors are thrown back, leave a comment and I'll attempt to help you. Also, any comments or suggestions are welcome.