How to delete windows game with batch file

I have group of machines that I want to use a batch file to delete the windows games (sol,exe, winmine.exe etc..() from the machines. For various reasons i do not want to use the add/remove applet to do this. I wrote a simple bat file to delete the executables but seconds after the files that i deleted are then recreated again by the system??? How can i write a .bat file to remove the games? i believe for some reason that these are considered windows protected files so you cant delete them this way, is there an easy workaround?
Who is Participating?
bluntTonyConnect With a Mentor Commented:
To remove the windows games component permanently, you can run this vbscript:

Dim Fso : Set Fso = CreateObject("Scripting.FileSystemObject")
Set WshShell = WScript.CreateObject("WScript.Shell")
sPrograms = WshShell.SpecialFolders("AllUsersPrograms")
If (Fso.FolderExists(sPrograms & "\Games")) Then
 ' Create file for uninstalling games
 Set f = Fso.CreateTextFile("c:\windows\inf\wmdtocm.txt", True)
 WshShell.Run "sysocmgr.exe /i:c:\windows\inf\sysoc.inf /u:""c:\windows\inf\wmdtocm.txt"" /q", 1, True
 Fso.DeleteFolder(sPrograms & "\Games"), True
End If

Works in XP and will remove all the built-in games from the system.

create a batch file,
something like this,

c:\Proram Files\Game name\game.exe -remove

and run the batch file
thanks hope this helps
DavidNPDAuthor Commented:
As my post advised, that was my first attempt. The games are protected windows files, a simple bat file does not work.
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Save as a .vbs rather than a .bat and run, or to run as part of an existing batch file, add a call like:

cscript removegames.vbs
DavidNPDAuthor Commented:
That worked great, thanks
was dying to find the way to script this. Even got rid of the start menu folder - Thanks!

II've voted the comment most helpful :)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.