If you have a critical encoder streaming live
audio for an Internet radio station or maybe video for a presentation
then you want that encoder to be running all the time and you
shouldn't have to login and restart the encoder manually if the
host computer loses power or reboots. The Windows Media Encoder
has a wonderfully simple graphical user interface but unfortunately
you cannot directly configure it as a service to run in the background
when the host starts up. Fortunately Microsoft provides a command
line script that you can use to start an encoding session on
boot-up.
- Windows 98, ME, NT, 2000, 2003, XP
- Windows Media Encoder (preferably version
9) Download
- Windows Media Encoder Series SDK (preferably
version 9) Download
- Windows Media Encoder Session File (*.WME)
configured for your stream
- Download and install the WME Series SDK somewhere
on your computer.
- Create a convenient folder to store your
files on your hard drive, I recommend “C:\WME”
- Open the SDK folder and find the file called “Wmcmd.vbs”.
If you installed in the default path it will be under “C:\WMSDK\WMEncSDK9\samples\vb\wmcmd” Copy
this file to your new WME folder.
- Create your Session file using the WME graphical
interface and save it to your WME folder.
- Open Notepad (under Programs | Accessories)
and enter a line such as the following, substituting the correct
file names and paths:
cscript.exe path_to_wmcmd.vbs –wme path_to_session_file |
For example:
cscript.exe C:\WME\wmcmd.vbs –wme C:\wme\stream1.wme |
Note: for Win 98 and ME you may get away without the preceeding "cscript.exe" or
you can try just "script.exe"
- Save the file with the .BAT extension. The
easiest way to do this is to put quotation marks around the
file name in the Notepad dialog box. For example type “encode.bat” with
the quotes.
- Test the new .BAT file by finding it with
My Computer or Explorer and double clicking it. A black DOS
box should open and periods (.) should start to appear as encoding
progresses. Check to make sure you can access your stream.
Now there are two ways to make your .BAT file
start automatically without anyone having to logon.
The best method is to purchase or find a utility
that will allow the .BAT file to run as a service so that no
one has to log onto the host for the stream to encode. I recommend
the FireDaemon Service Manager and
I have a tutorial on how to setup this program here.
The other way is to simply force the computer
to logon a user automatically. Here is how:
- Create a shortcut in your STARTUP folder to
the .BAT file. You can right click on the .BAT file from My
Computer or Explorer and select “Create Shortcut”.
Then move the new shortcut to “C:\Documents and Settings\All
Users\Start Menu\Programs\Startup”
- Open the Regedit program by clicking START
| RUN and typing “regedit” in the box. Then
click Run.
- Navigate to “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Winlogon”
- There should be an entry called “DefaultUserName” Double-click
this key and change the name to a legitimate user on the system.
- Change “DefaultDomainName” if
your user is not located on this host.
- If you don't see an entry labeled “DefaultPassword”,
add it by clicking EDIT then NEW then STRING VALUE. Call it “DefaultPassword” and
double-click it to enter your password.
- If “AutoAdminLogon” does
not exist, create it the same way and give it a value of “1”
Now close regedit and reboot the machine. If
all goes well you should see the machine logon and the DOS box
will open loading the stream. If you get an error logging on,
try using regedit to enter an administrator account as the user.