Script to automatically login to Steam and launch HLDJ

Cool tips, tricks, FAQs, scripts, binds, etc.

Script to automatically login to Steam and launch HLDJ

Postby kevin32 » Thu Mar 29, 2012 11:03 am

So you have two or more Steam accounts on the same computer, and therefore can't use the 'Remember my password' option on the Steam sign in window.

You want to login automatically without having to type your username and password, and launch HLDJ immediately afterwards. Here's what you do: (NOTE: This tip applies only to Windows and uses the command line. If you are not experienced with the command line, get someone with experience to help you.)

1. In HLDJ Options, check 'Launch game application' and 'Auto-start default game'

2. Open a text document and paste the following code (assume the steam login name is 'username' and the password is 'password'):

Code: Select all
cd C:\Program Files\Steam\
start steam.exe -login username password
ping -n 20 > nul
cd C:\Program Files\hldj32
start hldj.exe

3. Save the text document as a batch file by changing the .txt file extension to .bat

Now when you double-click the batch file, you will log into Steam automatically, and HLDJ will launch the game you want to play. Note that the lines that begin with 'cd' must point to the respective folder where the Steam and HLDJ executables are located.


Q: I don't like the icon of the batch file? How do I change it?
A: You'll want to create a shortcut to the batch file, then change the icon of the shortcut. Right-click the batch file, select copy, then right click your desktop and select 'Paste shortcut'. Right-click the new shortcut file, select 'Properties' and click the 'Change icon' button.

Q: Is my username and password safe this way?
A: The username and password is encrypted in the Steam client when it logs you in. But a computer savvy person who has access to your computer might find it if they're looking for it specifically. This shouldn't be an issue if the computer is part of a family household. But if you're still concerned that others may compromise your username and password, you can encrypt the batch file (Right click the batch file, click 'Properties', click 'Advanced', check 'Encrypt contents to secure data'. Click OK, then OK. On the Encryption Warning dialog, check 'Encrypt the file only', then click OK. Now anyone who tries to double-click or open your file under their account will get an 'Access denied' message.)

Q: Why is there a 'ping' command, and whose IP address is that?
A: The 'ping' command will ping your computer's IP address, but for the purposes of the script, it acts as a timer to give Steam the necessary time it takes to login your account before launching HLDJ. '-n 20' represents the number of 'seconds' you want the script to wait before it launches HLDJ. 20 seconds is a decent time to wait for Steam to login accounts. If HLDJ launches too soon before you've been signed in, then extend the number of seconds. One issue you might encounter with timing is when Steam has to update the client, which is a rare occurrence.
Game DJ
Posts: 13
Joined: Thu Sep 09, 2010 3:04 am

Return to Tips & Tricks

Who is online

Users browsing this forum: No registered users and 1 guest