JSI Tip 5845. Hide items in the Add/Remove Programs applet of Control Panel using a batch.


In tip 5844, we used a freeware GUI to hide items in the Add/Remove Programs applet of Control Panel.

Using information from tip 0034, if we can change the DisplayName Value Name of an application to QuietDisplayName, the item will be hidden.

NOTE: See Another way to hide items in the Add/Remove Programs applet of Control Panel using a batch?

I have scripted HideFromAddRemove.bat to perform this function in batch, on either a local or remote computer.

The syntax is:

HideFromAddRemove \\ComputerName "ApplicationDisplayName1" \["ApplicationDisplayNamen"\]

where:

\\ComputerName is the local or remote computer on which you wish to hide an item.
"ApplicationDisplayName1"       is a quoted string that identifies the item to be hidden. Both the registry key and the DisplayName are searched. If you used "Microsoft", all applications that contain Microsoft will be hidden. The search is NOT case sensitive. DO NOT use the the following characters in your search string: < > & ! ( ) # |
"ApplicationDisplayNamen" Optional additional items that you wish to hide.

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

HideFromAddRemove.bat contains:

@echo off
setlocal
if \{%2\}

\{\} goto syntax set computer=%1 set computer=%computer:"=% if not "%computer:~0,2%" EQU "\\" goto syntax if exist "%temp%\hfars.tmp" del /q "%temp%\hfars.tmp" if exist "%temp%\hfara.tmp" del /q "%temp%\hfara.tmp" shift set OK=N set computer=%computer:\=% :inloop if \{%1\}

\{\} goto getreg set search=%1 set search=%search:"=% @echo %search%>>"%temp%\hfars.tmp" shift goto inloop :getreg set query=REG QUERY "\\%computername%\HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" /S for /f "Skip=4 Tokens=*" %%a in ('%query%') Do set work=%%a&call :parse if "%OK%" EQU "N" goto syntax set fnd=findstr /L /I /G:"%temp%\hfars.tmp" "%temp%\hfara.tmp" for /f "Tokens=1* Delims=#" %%a in ('%fnd%') do set appkey=%%a&set appdisplay=%%b&call :quiet if exist "%temp%\hfars.tmp" del /q "%temp%\hfars.tmp" if exist "%temp%\hfara.tmp" del /q "%temp%\hfara.tmp" endlocal goto :EOF :syntax @echo Syntax: HideFromAddRemove \\ComputerName "Application Display Name1" \["Application Display Namen"\] if exist "%temp%\hfars.tmp" del /q "%temp%\hfars.tmp" if exist "%temp%\hfara.tmp" del /q "%temp%\hfara.tmp" endlocal goto :EOF :parse set work=%work:<=% set work=%work:>=% set work=%work:"=% set work=%work:&=% set work=%work:!=% set work=%work:)=% set work=%work:(=% set work=%work:#=% if /i "%work:~0,18%" EQU "HKEY_LOCAL_MACHINE" goto app if /i "%work:~0,11%" EQU "DisplayName" goto appname goto :EOF :app set appkey=%work:HKEY_LOCAL_MACHINE=HKLM% goto :EOF :appname set display=%work% set display=%display:#=% for /f "Tokens=1,2*" %%n in ('@echo %display%') do set appdisplay=%%p# set appdisplay=%appdisplay: = % set appdisplay=%appdisplay: #=% set appdisplay=%appdisplay:#=% @echo %appkey%#%appdisplay%#>>"%temp%\hfara.tmp" set OK=Y goto :EOF :quiet set appdisplay=%appdisplay:#=% REG ADD "\\%computer%\%appkey%" /v QuietDisplayName /t REG_SZ /d "%appdisplay%">nul 2>&1 @echo Y| REG DELETE "\\%computer%\%appkey%" /v DisplayName>nul 2>&1


Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish