Trying to write a script to play a sound, need help!


Essential Member
Microsoft Community Contributor
Sub title "How to spend a lot of time trying to do something that Microsoft doesn't want you to, for some obscure reason".

Hi Guys

I'm trying to write a script to play a sound at Windows 8 startup.
I want to do this by placing the .vbs script file in the Startup Folder.

I read that this can be done, and I've researched it a bit.

I'll link to the research and the end of this post.

Here's my script.

strSoundFile = "C:\My Windows Sounds\Hello Michael Brit.wav"
Set objShell = CreateObject("Wscript.Shell")
strCommand = "C:\Small Player\splayer.exe" /play /close "C:\Windows\My Windows Sounds\Hello Michael Brit.wav"
objShell.Run strCommand, 0, True

Writing scripts is not something I do, I quit after .bat files. LOL
I just can't stand to let Microsoft win!!!

I have the 64 bit version of Small Player installed at the location shown, C:\Small Player\splayer.exe.

My sound is in C:\Window\My Windows Sounds.

The file is named Hello Michael Brit.wav.

I've verified that the sound does play in Small Player, etc.

If anyone who understands this stuff can identify what I'm doing wrong I'd appreciate it.

I'm getting the error message...

Line 3, Char: 57 Error Expected end of statement.
Code 800A0401

I have no idea what that means.



Here's the research.

How Can I Play a Sound From Within a Script? - Hey, Scripting Guy! Blog - Site Home - TechNet Blogs

And this post...

As R Sully said, you can make the sounds in question re-appear, but they do not re-sound. For those like me who were stumped by this issue (I'm running Windows 8 Build 9200), I propose a simple solution that works fine for me: Create a script and put it in your (not All users/public) Startup folder.

It's in a hidden folder under your User root called AppData. This script is located at the following website: please paste this link into your address bar-my ability to link is compromised right now.

How Can I Play a Sound From Within a Script? - Hey, Scripting Guy! Blog - Site Home - TechNet Blogs

There's something you should know-sndrec32.exe is no longer in windows 8 and the new SoundRecorder.exe, located in the system32 folder, is unable to run from there because it's 64-bit and cannot launch from a 32-bit container.

I suggest smallplayer portable, available from Softpedia via this link: you need to paste it-I cannot link for some reason...
Small Player Free Download - OGG Players

When you compose the script (using notepad), make sure you replace the sndrec32.exe path with the file location of smallpayer0.74.

To copy a path, simply use the command on File explorer when the file is highlighted. Then highlight the path for sndrec32, and paste the link over it.

Delete any quotation marks that are not outside the total path, arguments included (e.g. /play /close) otherwise the script will fail, showing you a dialog that says where the error is in the script, e.g. Line 3, Char 31.

For the sound you want to play, simply highlight the preset path from quote-to-quote, switch windows to look for a file, then when you find it, copy the file path using the same method you used to copy smallplayer0.74's path.

Then switch back to notepad, and use Ctrl+V to paste, and the path that was there previously will be replaced by what you pasted.

If the file looks similar to what The Scripting Guy displays (besides the edits I've mentioned), save as All files, and name the document with a .vbs extension (the name is up to you).

From there, copy and paste the .vbs file into your startup folder, located in %OS%\Users\%YOURUSER%\AppData\Microsoft\Windows\Start Menu\Programs\Startup\. You may need to "show Hidden Files and Folders."

I hope this works for anyone who's suffered the same frustration I had.

Last edited by a moderator:


Noob Whisperer
Wouldn't it be easier to just edit the registry key here
and here
to point to your wav file or maybe even better yet. Just rename you .wav file to Windows Logon.wav and put it here
%SystemRoot%\media\Windows Logon.wav
after renaming the one that is presently located there to something like Windows Logon.OLD
make sure you check the box that says play windows startup sound in Control Panel->Sounds->Sounds Tab


Essential Member
Microsoft Community Contributor
Hi Trouble

I've read that you can't edit the registry key because Windows 8 uses some kind of checker at startup and if it finds anything in this area changed it screws up Windows pretty badly.

I did this myself during beta, I used a app called Start Sound Changer, that works really well in Windows 7 and it totally borked my Windows 8 install.

I checked to see if it had been updated to work with Windows 8 and read that it can't be made to work with Windows 8 for the same reason, Microsoft put in commands that just won't let you change it.

So I thought since it doesn't play a sound anyway, I could just do it this way.

This is of course a totally useless waste of time, I just can't stand to let them win. LOL

I have created all my own Windows sounds for every pretty much every event, i.e. when I empty the recycle bin my Lucy voice says "Enough of this Trash!".

I haven't tried just putting in my own file with the same name, but I'm pretty sure that I read, that won't work either because the file size doesn't match what Windows expects to see.

In Windows 7 you had to edit the Windows/system32/imageres.dll file.
You can do that in Windows 8 too, but it messes things up for the same reason, it doesn't pass the boot checker.

I did that for a long time in W7 until the Start Sound Changer came along, that let you do it in a couple of clicks.



Well-Known Member
Mike, I’m glad that you mentioned about not hearing a startup sound for Windows 8. I live in a somewhat noisy environment and never noticed it.
Actually Windows 8 does have a startup sound. It’s just not enabled by default.
You can go to Control Panel > Sound > click on the sounds tab and tick the selection box for “Play Windows Startup sound”. Click apply. It sounds just like the Windows 7 default startup sound.

In order to change it, this requires editing the imageres.dll file. There is a tutorial that explains in detail how to do it. It lists two methods that work. Since we are dealing with Windows 8, only option 2 is viable. You can still do it with option one but there are other steps and factors involved that are not listed because the post was intended for windows 7 systems originally. Choose option two and follow the steps in the tutorial.

I wanted to try this out personally and it worked liked money in the bank! The only thing that I omitted was the last steps involving the creation of a recovery disk. It’s not necessary for me since I wasn’t using Windows 8 while making changes with system dll files. I have a dual boot system and simply used two applications that made things so much simpler. Also the author mentioned that it was only necessary to modify the imageres.dll file in the System32 directory. I modified all 4 that were found on my system. I would at least recommend that you modify the ones found in System32 and SysWOW64. I even changed the other 2 located in my backup system image files as well. That automatically created additional backups from windows. I deleted those as well. I already have 4 backups, just in case.

“Take Ownership” is for file permissions and “Resource Hacker” is invaluable for editing system files. The link for Resource Hacker is in the tutorial. Take Ownership can be found easily. I’ve had it on my system for a couple of years. When using Take Ownership, sometimes you can’t edit or delete a file unless you take ownership of its parent folder. Remember also that whatever startup file you are replacing, click to play it in Resource Hacker to make sure it’s working fine. It’s in the tutorial as well.

Whatever route you choose to take, make sure that you have the selection box for “Play Windows Startup sound” ticked and click apply before you edit anything.
If you don’t, it won’t work. You will have to repeat the entire process over again.

Here’s the link to the tutorial: Startup Sound - Change in Windows 7 - Windows 7 Help Forums

Keep in mind that All of this has to be done just right or you could render the system unusable. Since it’s getting closer to a release date for 8.1, you may want to wait and try it then…but if you like to tinker and experiment with things, Go for it..

Last edited by a moderator:


Essential Member
Microsoft Community Contributor
Hi Gintonic

I do have the Windows Start Sound box checked but it never plays the sound.

I don't know why, I do believe that I heard it a couple of times but on a daily basis it doesn't play.

I've rebooted and listened for it but no sound.

I read someplace that this has something to do with Windows 8 not really being turned off, some files are held in limbo someplace and when you boot they activate and that stops the sound from playing. Someplace you can tell Windows to completely shut off and then the sound will play.

I have no idea if this is correct or not.

Anyway I'll take a look at the link you provided.

Back in the old days I used to write .bat files that would do stuff like this.

I once made a computer voice file in the old mechanical sounding voice that they used to do, and set it to play at startup.

When my friend came over and we sat down to work on my computer, it booted up and said...

"Hello Michael, nice to see you, Oh!, I see Phil is here too, What a bummer!"

This was way back in the Windows 3.1 days, and he was totally surprised, it really cracked him up.



Essential Member
Microsoft Community Contributor

Yes, this is exactly the way I did it in Windows 7, before Startup Sound Changer came along.

I think I still have the File Hacker installer on here someplace.

However when I did this during Windows 8 beta it totally messed up my install.

I suppose I could give it a try, I can always boot into Ubuntu and restore the original imageres.dll file if it screws up things.



Well-Known Member
There are a few users that have reported problems when trying to edit the dll files if their Windows 8 was an upgrade. There must be a slight difference from the original imageres.dll file. It may also be attributed to just editing the file found in the System32 directory and not including the other in SysWOW64. I’ve always done clean installs because there are bound to be some leftover bugs from the previous system. The only upgrade that I can remember doing was from ME to XP. That was very problematic.

All I can say is that this worked for me perfectly. But, I had to do it twice because I didn’t have the box checked for the startup sound to play. So no changes were made. I had to redo the entire process and it worked flawlessly. As long as you are not in Windows 8 when you are editing the dll files, it only takes about 5 minutes to do it. The Take Ownership tool is a must in order to do things quickly. The key is preparation. If you have already made backups of the files and have multiple windows of windows explorer open with folders created for each task, it’s so much quicker and easier.

I noticed in your earlier post that you mentioned the startup sound is checked but you’ve only heard it a couple of times. Do you have the hybrid boot (fast startup) feature enabled? That feature saves everything in the current state so that when you shutdown and restart, it takes very little time to get up and running. It’s similar to hibernation. That could definitely have something to do with the startup sound not playing. In some systems, it’s enabled by default. You can check your power settings and see what’s enabled.

Last edited by a moderator:


Essential Member
Microsoft Community Contributor

Yes, that's why I'm not hearing the sound.

I finally figured that out.



Well-Known Member
Yes, that setting could possibly (not likely but you never know) cause other problems when trying to edit system files, so it is advisable to turn it off.

Last edited by a moderator:


Essential Member
Microsoft Community Contributor


I found 2 locations for the Windows Logon Sound on my computer.

Search Window 01.JPG

The first two are mine, the bottom two are both part of the Windows installation.

I thought that I would try substituting my own sound for these.
It didn't make any difference.

That's when I played these sounds and discovered that they are not the sounds that Windows 8 plays when it boots.

When Windows starts it plays a sound that is not shown anyplace on my computer.

So either it's hidden someplace or it has a different name then "Windows Logon.wav.

I haven't tried editing the registry as Randy suggested but I did look and saw that the entry points to the sound in the Media folder which is not the sound I hear when I boot up, pretty weird, the sound I hear sounds like the old Windows 7 sound.

This is not an upgrade from Windows 7 it is a new install and a new computer.


Last edited by a moderator:


Well-Known Member
Yes the startup sound is the same as the Windows 7 startup wav.
I doubt the startup sound can be found as just a simple wav file. To prevent tampering with it, the more likely scenario is that it’s been embedded in the imageres.dll file or some other system dll or exe files as well. That was the first thing that many windows users searched for when trying to find an easy fix for replacing the startup sound with their customized choice. You may find it by using an advanced dll extractor or viewer. I feel fairly certain that if both System32 and SysWOW64 locations of the imageres.dll files are edited correctly and verified by playing the replacement wav, it will work flawlessly.

The only problem is that when Windows 8.1 rolls out, it may have to be done again. I know that I will have to do it all over because when the final version comes out, I will do a clean install. There is a registry setting that allows you to unlock all of the sound settings that you could change in Windows 7. That is when I discovered that the logon and startup wavs are supposed to be totally different because that’s the way it was set up. I thought that they were the same to until I played the logon wav. This will not change any setting for the startup wav but it does allow you to control previously locked and hidden options in the sounds control panel. Link:

Last edited by a moderator:


Essential Member
Microsoft Community Contributor
I guess I'll wait until I get the new version of Windows 8 installed and then look at this again.

For now I'll live with the dingy dingy sound.

Maybe someone will come up with an app like they did with Windows 7.


This website is not affiliated, owned, or endorsed by Microsoft Corporation. It is a member of the Microsoft Partner Program.