February 20, 2012

VBS script - No Games

Option Explicit

Dim WshShell, WshFile, file, sPrograms
Set wshShell = WScript.CreateObject("WScript.Shell")
Set wshFile = Wscript.CreateObject("Scripting.FileSystemObject")

Sub NoGames()
    sPrograms = WshShell.SpecialFolders("AllUsersPrograms")
        If (WshFile.FolderExists(sPrograms & "\Games")) Then
            Set file = WshFile.CreateTextFile("C:\WINDOWS\inf\wmdocm.txt", True)
            file.WriteLine("[Components]")
            file.WriteLine("freecell=off")
            file.WriteLine("hearts=off")
            file.WriteLine("minesweeper=off")
            file.WriteLine("msnexplr=off")
            file.WriteLine("pinball=off")
            file.WriteLine("solitaire=off")
            file.WriteLine("spider=off")
            file.WriteLine("zonegames=off")
            file.Close
        WshShell.Run "sysocmgr.exe /i:c:\WINDOWS\inf\sysoc.inf /u:""C:\WINDOWS\inf\wmdocm.txt"" /q", 1, True
        WshFile.DeleteFolder(sPrograms & "\Games"), True
        End If
End Sub

No comments:

Post a Comment