JSI Tip 9851. Another way to hide items in the Add/Remove Programs applet of Control Panel using a batch?

Jerold Schulman

October 26, 2005

2 Min Read
ITPro Today logo in a gray background | ITPro Today


In tip 5845, we added the QuietDisplayName and deleted the DisplayName Value Name to hide an item from Control Panel's Add/Remove Programs applet.

If the application was installed with Windows Installer technology, the WindowsInstaller Value Name, a REG_DWORD data type, is set to a 1. If WindowsInstaller contains a 1, you can hide the item by adding a SystemComponent Value Name, a REG_DWORD data type, and setting it to 1.

I have changed HideFromAddRemove.bat to incorporate the additional method.The syntax for using HideFromAddRemove.bat is:

HideFromAddRemove \ComputerName "ApplicationDisplayName"

where:

\ComputerName

is the local or remote computer on which you wish to hide an item.

"ApplicationDisplayName"      

is a quoted string that identifies the item to be hidden. Only the DisplayName is searched. If you used "Microsoft", all applications that contain Microsoft in the DisplayName will be hidden. The search is NOT case sensitive. DO NOT use the the following characters in your search string: < > & ! ( ) # |

NOTE: HideFromAddRemove.bat uses REG.EXE on Windows 2000, from the Windows 2000 Support Tools, or REG.EXE built into Windows XP, Windows Server 2003, and later.

HideFromAddRemove.bat contains:

@echo offif {%2}=={} @echo Syntax: HideFromAddRemove \ComputerName "Application Display Name"&goto :EOFsetlocal ENABLEDELAYEDEXPANSIONset computer=%1set computer=%computer:"=%set OK=Nset WI=Nset computer=%computer:=%set search=%2set search=%search:"=%set qry1=REG QUERY \%computername%HKLMSOFTWAREMicrosoftWindowsCurrentVersionUninstallset fnd1="SOFTWAREMicrosoftWindowsCurrentVersionUninstall"for /f "Tokens=*" %%a in ('%qry1%^|find /i %fnd1%') Do ( set appkey=\%computername%%%a call :WIset>nul 2>&1 for /f "Tokens=*" %%i in ('REG QUERY "!appkey!"^|find /i "%search%"') do set wrk1=%%i&call :p2)if "%OK%" EQU "N" @echo NOT FOUND: %computername% %search% endlocalgoto :EOF:p1set wrka=%wrk1:=%set wrka=%wrka:"=%set wrka=%wrka:&=%set wrka=%wrka:!=%set wrka=%wrka:)=%set wrka=%wrka:(=%set wrka=%wrka:#=%goto :EOF:p2call :p1set wrk3=%wrka:QuietDisplayName=%if "%wrka%" NEQ "%wrk3%" set OK=X&goto p2xset wrk3=%wrka:DisplayName=%if "%wrka%" NEQ "%wrk3%" set OK=Y:p2xif "%OK%" EQU "N" goto :EOFif "!WI!" EQU "Y" goto p3if "%OK%" EQU "X" goto :EOF@echo REG ADD "!appkey!" /v QuietDisplayName /t REG_SZ /f /d "%search%"REG ADD "!appkey!" /v QuietDisplayName /t REG_SZ /f /d "%search%"REG DELETE "!appkey!" /V DisplayName /F >nul 2


Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like